forked from sontek/homies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_zshrc
192 lines (155 loc) · 5.97 KB
/
_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
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
183
184
185
186
187
188
189
190
191
192
ZSH=$HOME/.oh-my-zsh
export ZSH_THEME="xiong-chiamiov-plus"
export UPDATE_ZSH_DAYS=13
plugins=(
# aws
# colorize
# git
# go
# pip
# python
# docker
# docker-compose
# brew
# virtualenvwrapper
# tmux
zsh-syntax-highlighting # has to be the last
)
# Customize to your needs...
#export PS1="$PS1`~/bin/svn-ps1.py`"
function dockerrmall {
docker rm `docker ps --all | awk '{print $1}' | tail +2`
docker images -qf dangling=true | xargs -I {} docker rmi -f {} && docker images | grep "^<none>" | awk "{print }" | xargs -I {} docker rmi -f
}
alias dockerrmallimages="rm -rf ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2"
function sshans {
ssh -i ~/.ssh/ansible ubuntu@$*
}
# ansible with digital
function sshdgtl {
ssh -i ~/.ssh/ansible root@$*
}
function sshpup {
ssh -i ~/.ssh/puppeteer ec2-user@$*
}
function sshdio {
ssh -i ~/.ssh/dimadio ec2-user@$*
}
function fn {
find . -not -path '*/\.*' -type f -name "*$**"
}
function vimg {
vim `ag -l "$*"`
}
function vimf {
vim `fn "$*"`
}
function rsharkz () {
ssh "$@" "sudo tcpdump -i any -s 0 -w - 'not port 22' | bzip2 --stdout --fast" | bzip2 --decompress - | pv | wireshark -S -l -k -N mnNtCd -i - 2> /dev/null
}
function rshark () {
ssh "$@" "sudo tcpdump -i any -s 0 -w - 'not port 22'" | pv | wireshark -S -l -k -N mnNtCd -i - 2> /dev/null
}
#
#function rshark () {
# ssh "$@" "sudo tcpdump -i any -n -U -s 0 --buffer-size=2048 -w - 'not port 22'" | pv | wireshark -S -l -k -N mnNtCd -i - 2> /dev/null
#}
#function rsharkz () {
# ssh "$@" "sudo tcpdump -i any -n -U -s 0 --buffer-size=2048 -w - 'not port 22' | bzip2 --stdout --fast" | bzip2 --decompress - | pv | wireshark -S -l -k -N mnNtCd -i - 2> /dev/null
#}
# bind up and down keys to filter history by the current cmd prefix
autoload up-line-or-beginning-search
autoload down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
# set the key var with terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-beginning-search
# double ctrl-x will show all history options:
autoload -Uz history-beginning-search-menu
zle -N history-beginning-search-menu
bindkey '^X^X' history-beginning-search-menu
fpath=(~/.zsh-completions/src $fpath)
unsetopt correct_all
source ~/.profile
export PATH=/usr/local/bin:/usr/local/sbin:~/Workspace/misc/devops_scripts/:~/Workspace/lp-aws-saml/:$PATH
# GO
export GOPATH=~/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:/usr/local/opt/go/libexec/bin
export PATH="~/google-cloud-sdk/bin:$PATH"
[[ -s "/Users/doody/.gvm/scripts/gvm" ]] && source "/Users/doody/.gvm/scripts/gvm"
# PYTHON
# export WORKON_HOME=~/virtualenvwrapper
# source /usr/local/bin/virtualenvwrapper.sh
source ~/.zshrc_secret
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
eval "$(pipenv --completion)"
# Source OH MY ZSH
source $ZSH/oh-my-zsh.sh
alias vpn='sshuttle -v -r ssh-gw.rounds.com --dns 0.0.0.0/0'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# core utils
# brew reinstall findutils --with-default-names
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f /Users/doody/Downloads/google-cloud-sdk/path.zsh.inc ]; then
source '/Users/doody/Downloads/google-cloud-sdk/path.zsh.inc'
fi
# The next line enables shell command completion for gcloud.
if [ -f /Users/doody/Downloads/google-cloud-sdk/completion.zsh.inc ]; then
source '/Users/doody/Downloads/google-cloud-sdk/completion.zsh.inc'
fi
# Aliases
alias ls="ls --color --ignore='*.pyc' --ignore='*.o'"
alias ll="ls -la"
alias pp="ipython"
alias grep='grep --exclude-dir="\.svn" -I -n'
alias nassh='ssh [email protected]'
alias tessh='ssh root@test-app'
alias webrestart='sudo /etc/init.d/apache2 restart'
alias webtail='ssh root@test-app "tail -f /opt/logs/www.log"'
alias apptail='ssh root@test-app "tail -f /opt/logs/appsrv.log"'
alias cdricapi='cd /opt/application/rounds/'
alias cdlive='cd /opt/application/live/appserver/'
alias cdubik='cd /opt/application/ubik/'
alias cdrvidyo='cd /opt/Vidyo-ServerSDK/samples/rvidyo'
alias resource='source $ZSH/oh-my-zsh.sh'
alias gh=hub
alias ubik='ssh -i ~/.ssh/ansible -t [email protected] "cd /opt/ubik; bash"'
alias tunnel-rkik='sshuttle -r ssh-bastion-rkik.rounds.video 10.32.0.0/16 172.16.0.0/24 --dns'
#alias tunnel-db='ssh -N -L 5432:ecosystem.c5hze3yp2tw7.us-east-1.rds.amazonaws.com:5432 ecosystem-bastion'
alias tunnel-db='ssh -N -L 5432:marketplace-db.kinmarketplace.com:5432 ecosystem-bastion'
alias netstat='lsof -PiTCP -sTCP:LISTEN'
export SSH_KEY_FILE=~/.ssh/id_rsa.np
export GITHUB_SSH_KEY=id_rsa.np
function awsswitch {
account=$1
export AWS_PROFILE=$account
export AWS_ACCESS_KEY_ID=$(sed -nr "/^\[$account\]/ { :l /^aws_access_key_id[ ]*=/ { s/aws_access_key_id = [ ]*//; p; q;}; n; b l;}" ~/.aws/credentials)
export AWS_SECRET_ACCESS_KEY=$(sed -nr "/^\[$account\]/ { :l /^aws_secret_access_key[ ]*=/ { s/aws_secret_access_key = [ ]*//; p; q;}; n; b l;}" ~/.aws/credentials)
export AWS_SESSION_TOKEN=$(sed -nr "/^\[$account\]/ { :l /^aws_session_token[ ]*=/ { s/aws_session_token = [ ]*//; p; q;}; n; b l;}" ~/.aws/credentials)
export AWS_SECURITY_TOKEN=$AWS_SESSION_TOKEN
if [[ $AWS_SESSION_TOKEN == "" ]]; then
unset AWS_SESSION_TOKEN AWS_SECURITY_TOKEN;
fi
}
awsswitch rkik
export AWS_DEFAULT_REGION=us-east-1
# JAVA
export JAVA_HOME=$(/usr/libexec/java_home)
unsetopt inc_append_history
unsetopt share_history
export PATH="/usr/local/opt/node@8/bin:$PATH"