2012年9月25日 星期二

ubuntu xampp php cli


http://ubuntuforums.org/showthread.php?t=1224146

/opt/lampp/bin/php is the command-line php installed by Xampp, so you need to add this line to your .profile:

Code:
PATH="/opt/lampp/bin:$PATH"

gitlab code review


http://www.bloggure.info/work/gitlabhq.html

Once a project created, you can manage it via the rich web interface GitLab offers.
There is :
  • an integrated issue tracker (without workflow, as simple as the one in github, an issue is open or closed),
  • a “merge request” section, you can view it as pull requests in github, it allows a developper to notify a reviewer its feature is ready to be merged into another branch (allowing code review),

2012年9月24日 星期一

gitlab


https://github.com/gitlabhq/gitlabhq/blob/stable/doc/installation.md

First 3 steps can be easily skipped with simply install script:
# Install curl and sudo
apt-get install curl sudo

# 3 steps in 1 command :)
curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu.sh | sh
Now you can go to Step 4
Or if you are installing on Amazon Web Services using Ubuntu 12.04 you can do all steps (1 to 6) at once with:
curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu_aws.sh | sh
for more detailed instructions read the HOWTO section of the script

1. Install packages

Keep in mind that sudo is not installed for debian by default. You should install it with as root: apt-get update && apt-get upgrade && apt-get install sudo
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix

# If you want to use MySQL:
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev

2. Install ruby

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xfvz ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure
make
sudo make install

3. Install gitolite

Create user for git:
sudo adduser \
  --system \
  --shell /bin/sh \
  --gecos 'git version control' \
  --group \
  --disabled-password \
  --home /home/git \
  git
Create user for gitlab:
# ubuntu/debian
sudo adduser --disabled-login --gecos 'gitlab system' gitlab
Add your user to git group:
sudo usermod -a -G git gitlab
Generate key:
sudo -H -u gitlab ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa
Get gitolite source code:
cd /home/git
sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite
Setup:
sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile'
sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; /home/git/gitolite/src/gl-system-install"
sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
sudo chmod 0444 /home/git/gitlab.pub

sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc
sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub"
Permissions:
sudo chmod -R g+rwX /home/git/repositories/
sudo chown -R git:git /home/git/repositories/

CHECK: Logout & login again to apply git group to your user

# clone admin repo to add localhost to known_hosts
# & be sure your user has access to gitolite
sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin

# if succeed  you can remove it
sudo rm -rf /tmp/gitolite-admin
IMPORTANT! If you cant clone gitolite-admin repository - DONT PROCEED INSTALLATION

4. Install gitlab and configuration. Check status configuration.

sudo gem install charlock_holmes --version '0.6.8'
sudo pip install pygments
sudo gem install bundler
cd /home/gitlab
sudo -H -u gitlab git clone -b stable git://github.com/gitlabhq/gitlabhq.git gitlab
cd gitlab

sudo -u gitlab mkdir tmp

# Rename config files
sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml

Select db you want to use

# SQLite
sudo -u gitlab cp config/database.yml.sqlite config/database.yml

# Or
# Mysql
# Install MySQL as directed in Step #1

# Login to MySQL
$ mysql -u root -p

# Create the gitlabhq production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;

# Create the MySQL User change $password to a real password
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';

# Grant proper permissions to the MySQL User
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';

# Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml
sudo -u gitlab cp config/database.yml.example config/database.yml

Install gems

sudo -u gitlab -H bundle install --without development test --deployment

Setup DB

sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production

Setup gitlab hooks

sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive
sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive
Checking status:
sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production


# OUTPUT EXAMPLE
Starting diagnostic
config/database.yml............exists
config/gitlab.yml............exists
/home/git/repositories/............exists
/home/git/repositories/ is writable?............YES
remote: Counting objects: 603, done.
remote: Compressing objects: 100% (466/466), done.
remote: Total 603 (delta 174), reused 0 (delta 0)
Receiving objects: 100% (603/603), 53.29 KiB, done.
Resolving deltas: 100% (174/174), done.
Can clone gitolite-admin?............YES
UMASK for .gitolite.rc is 0007? ............YES
/home/git/share/gitolite/hooks/common/post-receive exists? ............YES
If you got all YES - congrats! You can go to next step.

5. Server up

Application can be started with next command:
# For test purposes
sudo -u gitlab bundle exec rails s -e production

# As daemon
sudo -u gitlab bundle exec rails s -e production -d
You can login via web using admin generated with setup:
admin@local.host
5iveL!fe


6. Run resque process (for processing queue).

# Manually
sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes

# Gitlab start script
sudo -u gitlab ./resque.sh
# if you run this as root /home/gitlab/gitlab/tmp/pids/resque_worker.pid will be owned by root
# causing the resque worker not to start via init script on next boot/service restart
*Ok - we have a working application now. * *But keep going - there are some thing that should be done *

Nginx && Unicorn

Install Nginx

sudo apt-get install nginx

Unicorn

cd /home/gitlab/gitlab
sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb
sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D
Add GitLab to nginx sites & change with your host specific settings
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

# Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**
# to the IP address and fully-qualified domain name
# of the host serving GitLab.
sudo vim /etc/nginx/sites-enabled/gitlab
Restart nginx:
/etc/init.d/nginx restart
Create init script in /etc/init.d/gitlab:
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
Adding permission:
sudo chmod +x /etc/init.d/gitlab
Gitlab autostart:
sudo update-rc.d gitlab defaults
Now you can start/restart/stop gitlab like:
sudo /etc/init.d/gitlab restart


gitlab ssh key git@localhost's password


https://github.com/gitlabhq/gitlabhq/issues/293#issuecomment-5125487

When you add your users ssh keys to gitlab admin web interface make sure you take the pub key with no carriage return.
WRONG
```---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20120413"
AAAAB3NzaC1yc2EAAAABJQAAAIEAwTZaJGO3Fnmu25aHVZilXs1N1ZY4ZWH3K210
...
Sfsv/vkHQjmGDlusesk71MTJyO3cGQfZA/kfmktGoDLe1C7uyrCgLwMrCAXK6zD6
JSTKers=
---- END SSH2 PUBLIC KEY ----

__GOOD__
```ssh-rsa AAAAB3NzaC1yc(... really long string ...)zD6JSTKers= rsa-key-20120413```

2012年9月21日 星期五

(清空OR清除OR移除OR取消OR消)開始 關機


http://www.pczone.com.tw/vbb3/thread/3/108079/

Gpedit.msc > 使用者設定 > 系統管理範本 > [開始] 功能表和工作列

在右邊哪兒找有關 停用 [開始] 功能表上的 [登出] 和 停用並移除 [關機] 指令

這些只要改成已啟用就可以解決了。

2012年9月19日 星期三

google history(backup OR export OR takeout)


http://googlesystem.blogspot.tw/2007/04/google-web-history.html

* How to export all your web history?

You can export it as a feed. Here's the URL: http://www.google.com/history/lookup?q=&output=rss&num=1000 (the num parameter controls the number of items included in the feed).

git gui tortoisegit install on win

reference url:
http://forums.wasabistudio.ca/viewtopic.php?f=69&t=35793

TortoiseGit可到此下載: http://code.google.com/p/tortoisegit/downloads/list。根據系統的類型,選擇下載64bit或是32bit的版本;下載好以後安裝然後重開機。

重開好後,安裝msysgithttp://code.google.com/p/msysgit/downloads/list。下載Full installer for official Git 1.7.6,或是更新的版本。裝了這個以後TortoiseGit才能正常使用

git clone ( tortoisegit , command line git )

http://forums.wasabistudio.ca/viewtopic.php?f=69&t=35793

下載版本庫時,如果是透過 ssh url(e.g.: ssh://d68fbe50@g.s:29418/symfonyproject.git)
請先雙擊滑鼠左鍵,啟動桌面上的 git bash

依文章內容,產生 ssh key 後,再下載版本庫

使用 tortoisegit 步驟如下:
請開啟檔案瀏覽器,並在放置版本庫的父目錄(e.g.: D:\notscanned\git ),右鍵選單,點擊 git clone
出現對話框後,點擊OK

出現對話框,詢問是否信任該主機的 rsa key fingerprint ,點擊 yes

出現對話框,詢問私鑰通行語為何

輸入私鑰通行語後,點擊 OK

出現 clone 進度對話框,下載完成後,提示 success ,點擊 close 關閉對話框

結果如下:

命令列步驟如下:
cd /path/to/projects
git clone ssh://d68fbe50@g.s:29418/symfonyproject.git