-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_aliases
182 lines (153 loc) · 4.38 KB
/
.zsh_aliases
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
DOTFILES_ALIASES=TRUE
export DOTFILES_ALIASES
alias ls="ls ${LS_OPTIONS}"
alias cl='clear'
alias pso='ps -e -o user,comm | grep -v USER | sort'
alias psa='ps -aexfw -m'
alias wide='stty rows 24 columns 80'
alias rgrep='grep --context=2 -siIrn'
alias pgrep='pgrep -fl'
alias gcat='grep -siIn --context=0 .'
alias cp='cp --reflink=auto'
alias il='sudo iptables -nL --line-numbers'
alias np='sudo netstat -tuanp'
alias v='sudo vi'
# Bash shell driver for 'go' (http://code.google.com/p/go-tool/).
function go {
export GO_SHELL_SCRIPT=$HOME/.__tmp_go.sh
python -m go $*
if [ -f $GO_SHELL_SCRIPT ] ; then
source $GO_SHELL_SCRIPT
fi
unset GO_SHELL_SCRIPT
}
stripcert() {
openssl rsa -in $1 -out $1.stripped
}
getcerts() {
echo QUIT | openssl s_client -connect $1 -showcerts
}
tp() {
nc -v -w 10 -z $1 $2
}
if (( ${+SPLUNK_HOME} )); then
alias splunk="sudo -u splunk $SPLUNK_HOME/bin/splunk"
alias outputs='splunk btool outputs list'
alias btool='splunk btool check --debug | grep -v Checking | grep -v spec'
fi
if [ -d /opt/puppetlabs ]; then
alias puppet="sudo /opt/puppetlabs/bin/puppet"
alias puppetd="sudo /etc/init.d/puppet"
alias pat="sudo /opt/puppetlabs/bin/puppet agent -t | grep -v 'Info:' | grep -v '\.rb\]\/ensure'"
alias pte="sudo -E /opt/puppetlabs/bin/puppet agent --onetime --no-daemonize --environment"
alias facter="sudo FACTERLIB=/opt/puppetlabs/puppet/cache/lib/facter /opt/puppetlabs/bin/facter"
alias plint="/opt/puppetlabs/bin/puppet parser validate"
alias rmate="sudo PATH=/opt/puppetlabs/bin:$PATH ~/bin/rmate"
alias fwrules='sudo iptables -nL --line-numbers'
alias noderules="fwrules | grep '* 6'"
alias rolerules="fwrules | grep '* 5'"
fi
peek () {
if [ `uname` = "SunOS" ]; then
TAR=gtar
else
TAR=tar
fi
UNZIP=unzip
case ${1} in
*.tar.bz2 )
${TAR} -jtvf ${1} ;;
*.tar.gz )
${TAR} -ztvf ${1} ;;
*.tgz )
${TAR} -ztvf ${1} ;;
*.tar )
${TAR} -tvf ${1} ;;
*.zip )
${UNZIP} -lv ${1} ;;
esac
}
if [ `uname` = "Darwin" ]; then
alias sleepoff="sudo pmset -a hibernatemode 0"
alias sleepon="sudo pmset -a hibernatemode 1"
alias spot='mdfind -onlyin `pwd`'
alias vpnkill='sudo /usr/bin/killall -9 racoon'
alias lserv='sudo /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -r'
# Quit an OS X application from the command line
quit () {
for app in $*; do
osascript -e 'quit app "'$app'"'
done
}
relaunch () {
for app in $*; do
osascript -e 'quit app "'$app'"';
sleep 2;
open -a $app
done
}
zap () {
open -a AppZapper /Applications/"${1}".app
}
pman () {
man -t "${1}" | open -f -a /Applications/Preview.app
}
bman () {
MANWIDTH=160 MANPAGER='col -bx' man $@ | bbedit
}
fi
if [ `uname` = "Linux" ]; then
alias netlstat="sudo netstat -tupan | grep LISTEN | less"
alias du='du -sh * | sort -rh | grep -v ^0'
alias dnsd='date +%Y%m%d'
alias meminfo='sudo dmidecode --type 17'
alias dropcaches='echo "echo 3 > /proc/sys/vm/drop_caches" | sudo sh'
alias apt-get='sudo apt-get'
alias apt-cache='sudo apt-cache'
alias dpkg='sudo dpkg'
alias agents="env | grep -iE 'ssh|gpg|agent|key'"
badblocks() {
dmesg | grep csum | grep -oE 'ino [[:digit:]]+' | sort -u
}
whichport() {
sudo tcpdump -nn -vvv -i ${1} -s 1500 -c 1 'ether[20:2] = 0x2000'
}
add_cert() {
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n $1 -i $1
}
del_cert() {
certutil -d sql:$HOME/.pki/nssdb -D -n $1
}
list_cert() {
certutil -d sql:$HOME/.pki/nssdb -L # add '-h all' to see all built-in certs
}
add-app-key() {
gpg --keyserver subkeys.pgp.net --recv-keys $1
gpg --armor --export $1 | sudo apt-key add -
}
open() {
if [ -d ${1} ]; then
thunar ${1}
fi
}
fi
install-go() {
cd /tmp
git clone https://github.com/trentm/go-tool.git
cd go-tool
python setup.py install
sudo python setup.py install
cd
rm -rf /tmp/go-tool
}
install-omz() {
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ln -sf ~/dotfiles/.zshrc ~/.zshrc
}
install-ratom() {
[ ! -e ~/bin ] && mkdir ~/bin
curl -o ~/bin/ratom https://raw.githubusercontent.com/aurora/rmate/master/rmate
chmod +x ~/bin/ratom
}
# Local config
[[ -f ~/.zsh_aliases.local ]] && source ~/.zsh_aliases.local