Misc Notes

terminal

iterm2 - about readline

~/.inputrc example

1
2
3
4
5
6
7
8
9
10
11
12
set show-all-if-ambiguous on
set completion-ignore-case on
# utf-8 to solve error
set input-meta on
set output-meta on
set convert-meta off
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward

Use ruby to check keycode

1
2
"\C-x" # control - x
"\M-\C-a" # meta - control - a

Git

http://cheat.errtheblog.com/s/git

http://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit

Pulling

1
git pull --rebase

Removing a Branch

1
git push origin :newfeature

Merging

Make sure the branches be synchronized local and remote.

Use no fast forward to do the merge.

1
git merge --no-ff

If something done wrong and pushed

1
2
git reset --hard [commithash-or-HEAD~n]
git push -f

Using vim-diff or custom tool to resolve conflict files after merge

1
git mergetools

Merging a single commit

1
git cherry-pick [commit-sha1]

Saving temporal states

1
2
3
git stash
git stash list
git stash pop

AppleScript

Switch between TextMate and Chrome.

Create a new service with automation

1
2
3
4
5
6
7
8
9
10
on GetCurrentApp()
tell application "System Events" to ÂŹ
get short name of first process whose frontmost is true
end GetCurrentApp
if GetCurrentApp() is equal to "TextMate" then
tell application "Google Chrome" to activate
else
tell application "TextMate" to activate
end if

Then set the key in system preference.

GDB

Generate core dump for a live process.

1
2
3
4
5
gdb -q -- 2575
(gdb) generate-core-file
(gdb) detach
(gdb) quit
# core.2575

TextMate

AckMate 1.1.2 is broken because the author doesn't know anything about UTF-8, use 1.1.1

Comments