-
Notifications
You must be signed in to change notification settings - Fork 1
/
oh-my-zshrc
123 lines (106 loc) · 3.38 KB
/
oh-my-zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
ZSH=$HOME/.oh-my-zsh
# steeef
# sorin
# simple
# robbyrussell
# nicoulaj
ZSH_THEME="gentoo"
DISABLE_AUTO_UPDATE="true"
HIST_STAMPS="mm/dd"
plugins=(git ruby rake rails node npm vagrant ssh-agent zsh-completions osx bundler brew)
autoload -U compinit && compinit
source $ZSH/oh-my-zsh.sh
alias irc="TERM=screen-256color weechat-curses"
alias tm="tmux attach || tmux new"
alias fuck='sudo $(history -p \!\!)'
alias 'bemblock'='bem create -l desktop.blocks -b'
alias 'bempage'='bem create -l desktop.bundles -b'
alias gdfc="git diff --word-diff=color"
alias h="history"
alias j="jobs"
alias l="ls -lF ${colorflag}"
alias la="ls -laF ${colorflag}"
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
alias sudo='sudo '
alias update='sudo softwareupdate -i -a; brew update; brew upgrade --all; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update'
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
alias map="xargs -n1"
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m '$method'"
done
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias reload="exec $SHELL -l"
alias gds="git diff --staged"
alias gcm="git commit -m"
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tbz) tar -xjvf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "I don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file"
fi
}
pk () {
if [ $1 ] ; then
case $1 in
tbz) tar cjvf $2.tar.bz2 $2 ;;
tgz) tar czvf $2.tar.gz $2 ;;
tar) tar cpvf $2.tar $2 ;;
bz2) bzip $2 ;;
gz) gzip -c -9 -n $2 > $2.gz ;;
zip) zip -r $2.zip $2 ;;
7z) 7z a $2.7z $2 ;;
*) echo "'$1' cannot be packed via pk()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
c() { cd ~/code/$1; }
_c() { _files -W ~/code -/; }
compdef _c c
h() { cd ~/$1; }
_h() { _files -W ~/ -/; }
compdef _h h
unsetopt correct_all
if [[ -n $SSH_CONNECTION ]]; then
PROMPT='%m:%3~$(git_prompt_info)%# '
else
PROMPT='%3~$(git_prompt_info)%# '
fi
clck() {
wget -qO- "http://clck.ru/--?url=$1"\ | pbcopy
}
nda() {
wget -qO- "http://$nda_clck/--?url=$1"\ | pbcopy
}
if [[ -s "$HOME/.zlocal" ]] ; then
source "$HOME/.zlocal"
fi