Tuesday, January 20, 2015

Git cheat sheet


git clone
git branch hotfix@tianli
git checkout hotfix@tianli

modify code

git commit –a

arc diff


git checkout master
git pull

git checkout hotfix@tianli
git rebase master

git checkout master
git merge hotfix@tianli
git push


next round …


Monday, January 19, 2015

Phabricator + Git: a good practice for Scrum

Phabricator can be used to record all the backlogs for your sprint. The most amazing thing is to integrate with Git you can submit your code changes for review whenever you like.

Monday, January 5, 2015

Problem: sum for each column in a text file(ignoring the first line)

Solution:
cat file |awk -F " " 'function abs(x){return ((x < 0.0) ? -x : x)}NR>1{sum1+=$1; sum2+=abs($2)} END{print sum1;print sum2}'

Example:
$cat file
1000    1000
8       8
2       -2
3       0
7       5
$.my.sh
20
15

Ignore the first line in a text file

Problem:
    ignore the first line in a text file under Linux

Solution:
    1)  cat file |awk 'NR>1{print$0}'
    2)  cat file |sed 1d


Example:
$ cat file
1000    1000
8       8
2       -2
3       0
7       5

$ cat file |sed 1d
8       8
2       -2
3       0
7       5