git auto-completion
wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash source ~/.git-completion.bash
pushing to a non-bare git repo
Init a directory as a bare repo in the first place:
git init . # non-bare git init -bare . # bare
To be able to push into a non-bare repo, just check out a branch users don't push to:
git checkout -b DUMMY_BRANCH_DONT_USE
Or turn it into a bare repo:
rm * mv .git/* . rm .git sed -i 's/bare = false/bare = true/' config
Source: gitolite
git ignoring changes
Ignoring files in repository:
edit .gitignore git update-index --[no-]assume-unchanged FILE # if rule was added after the tracked file
Ignoring files in all repositories on your computer:
edit ~/.gitignore_global git config --global core.excludesfile ~/.gitignore_global
Ignoring local per-repository files:
edit .git/info/exclude
Source: github help
bash basics
Executing programs in parallel:
p1 ; p2 ; p3 ; ...
Note: use wait
if inside a script, so it waits for each child to finish.
Executing programs sequentially:
p1 ; p2 ; p3 ; ...
Executing programs sequentially, stop if one fails:
p1 && p2 && p3 && ...
bash case-insensitive filename tab-competion
Edit /etc/inputrc
:
add this line:
set completion-ignore-case on
shortcuts to find and grep
Writing these 2 line way too much a day.
Edit ~.bashrc
:
function gr { grep -Hrni $1 * } function f { find . -iname *$1* | grep -i $1 }
colorful man pages
Edit ~./Xdefaults
:
*VT100*colorULMode: on *VT100*colorUL: yellow !*VT100*italicULMode: on *VT100*underLine: off ! Uncomment this to use color for the bold attribute *VT100*colorBDMode: on *VT100*colorBD: cyan
merge two pdf documents
I had to sign a document, which was basically:
- Print the last, 5th page of the pdf.
- Sign the sheet.
- Scan it as a one-paged pdf.
- Change the 5th page from the pdf with the new one.
Again, the solution was pdfjam, which did the job of merging the first 4 page of the original document with the new pdf.
pdfjam original.pdf '1-4' new.pdf '-' --outfile merged.pdf
I found nice pdfjam examples at the The Bit Brothers.