-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
161 lines (133 loc) · 4.59 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
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# ZSH theme
ZSH_THEME="$(cat $HOME/.zsh_theme)"
# oh-my-zsh Plugins
plugins=(
git
rvm
bundler
kubectl
heroku
rails
rake
ruby
docker
docker-compose
zsh-syntax-highlighting
tmux
nvm
pip
npm
node
gulp
python
pyenv
virtualenv
)
# User configuration
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:$HOME/.local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
export LANG=en_US.UTF-8
# Options
setopt nonomatch # fix weird globbing output
# Command Aliases
alias l='ls -hG --color'
alias ll='ls -lhG --color'
alias sl='ls -hG --color'
alias ls='ls -hG --color'
alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}'
alias k='kontena'
alias knssh='kontena node ssh -u root'
alias ssh-keygen='ssh-keygen -b 4096'
alias hs='head *'
alias tree='tree -C'
alias setup_docker_network='ifconfig lo0 alias 10.254.254.254'
alias docker-rmi-dangling='docker rmi $(docker images -f "dangling=true" -q)'
alias docker-rmv-dangling='docker volume rm $(docker volume ls -qf dangling=true)'
alias mysqlmonitor="$HOME/.dotfiles/utils/mysql_monitor.sh"
alias ag='ag --color-match="3;31"'
alias git-date-branches="git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
# Set editor
if type "nvim" > /dev/null; then
export EDITOR='nvim'
else
export EDITOR='vim'
fi
alias vi="$EDITOR -p"
alias vim="$EDITOR -p"
# reenable venv prompt
export VIRTUAL_ENV_DISABLE_PROMPT=0
# NVM settings
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm
# OSX
export PATH=$PATH:/opt/local/bin
# GPG
export GPG_TTY=$(tty)
export GPG_AGENT_INFO
# Kontena settings
export SSL_IGNORE_ERRORS=true
which kontena > /dev/null && . "$( kontena whoami --bash-completion-path )"
# Docker settings
[[ -f "$HOME/.config/docker-gc-exclude" ]] && export EXCLUDE_FROM_GC="$HOME/.config/docker-gc-exclude"
# SSH
if [[ -f ~/.ssh/.auto-agent ]]; then
. ~/.dotfiles/ssh-find-agent.sh
ssh-find-agent -a
if [ -z "$SSH_AUTH_SOCK" ]
then
eval $(ssh-agent) > /dev/null
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
fi
fi
# zlib Config
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
# Helper functions/aliases
alias whatsmyip='dig +short myip.opendns.com @resolver1.opendns.com'
alias nsps='netstat -plunt | sort'
alias git-stats='git shortlog -sn'
alias ipinfo='curl https://ipinfo.io'
# check open port on macOS
function check-port {
[[ -n $1 ]] && lsof -n -i4TCP:$1 | grep LISTEN || echo "Port $1 is available for use!"
}
# Bump up the history!
export HISTSIZE=10000000
# start Kontena vpn
function kontena-vpn-start {
set -e
local pidfile=/var/run/kontena-openvpn.pid
if [[ -s $pidfile ]] && [[ -f /proc/$(cat $pidfile)/stat ]]; then
echo -n "Killing old openVPN process... "
sudo kill -TERM $(cat $pidfile)
while [[ -f /proc/$(cat $pidfile)/stat ]]; do sleep 1; done
echo "Done"
fi
local tmpfile=$(mktemp -t openvpn.XXXXX)
echo -n "Loading VPN config... "
kontena vpn config "$@" > $tmpfile
echo -n "Starting OpenVPN connection to $(awk '/^remote /{print $2}' $tmpfile)... "
sudo openvpn --daemon --writepid $pidfile --config $tmpfile
echo "Done"
(sleep 5; rm $tmpfile; rm -f /tmp/openvpn.*)&
}
# send file to rtb
function readthenburn {
[ -n "$1" ] || { echo "Usage: pass filename to upload file or use - to read stdin"; return 1; }
[ "$1" = '-' ] && { secret='<-'; action=write; } || { secret="@$1"; action=upload; }
url=$(curl -s -XPOST -F "secret=$secret" https://secure.bss-llc.com/readthenburn?action=$action)
if [ $? -eq 0 -a $action = "write" ]; then echo "$url/raw"; else echo $url; fi
}
# direnv
eval "$(direnv hook zsh)"
# source .profile for machine-specific settings
source ~/.profile
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"