-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
210 lines (170 loc) · 5.05 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
###### global .zshrc
#### source .zshrc_omz
export ZSH=~/.oh-my-zsh
ZSH_THEME="robbyrussell"
plugins=(
asdf
git
alias-tips
node
npm
#brew
osx
extract
z
zsh-256color
zsh-autosuggestions
#zsh-terraform
kubectl
terraform
)
export HIST_STAMPS="mm/dd/yyyy"
source $ZSH/oh-my-zsh.sh
# use zplug to manage addons
source ~/.zplug/init.zsh
# stop zsh update prompt, just update
export DISABLE_UPDATE_PROMPT="true"
# For ZSH users, uncomment the following two lines:
# why ?
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
# ???
fpath=(~/.zsh/completions $fpath)
autoload -U compinit && compinit
#### source .rc_android
# http://gianlucacosta.info/android-studio-ubuntu
# export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
# export PATH="/home/user/Android/Sdk/platform-tools:$PATH"
# export PATH="/home/user/Android/Sdk/tools/bin:$PATH"
#### source .rc_linux
# export SNAP=/snap/
# export PATH="/snap/bin/:$PATH"
# linux clipboard specific
# alias setclip="xclip -selection c"
# alias getclip="xclip -selection c -o"
# alias pbcopy=getclip
# alias pbpaste=setclip
#### source .rc_osx
# set g prefixed names with their default names
## m1
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
## non m1
# export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# export PATH="/usr/local/sbin:$PATH"
export HOMEBREW_CASK_OPTS="--appdir=~/Applications"
export HOMEBREW_NO_ANALYTICS=1
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
# iterm2 completion
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
#### source .rc_code
# go stuff
export GOPATH=~/go
export PATH="$GOPATH/bin:$PATH"
# pyenv
# eval "$(pyenv init -)"
# https://github.com/pyenv/pyenv-virtualenv
# eval "$(pyenv virtualenv-init -)"
# nvm
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
# direnv
eval "$(direnv hook zsh)"
#### source .rc_misc
## misc alias
alias vi="vim"
alias ls="ls -F --color=auto"
## ripgrep
alias rg="rg --hidden"
#### source .rc_terraform
# terraform cache
# export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"
alias tf="terraform"
alias tfi="tf init"
alias tfiu="tfi -upgrade"
alias tfriu="rm -rf .terraform && tfiu"
alias tfp="tf plan"
alias tfa="tf apply"
alias tfw="tf workspace"
alias tfwl="tfw list"
alias tfws="tfw select"
alias tfwss="tfws staging"
alias tfwsp="tfws production"
alias h="history"
#### source .rc_functions
# base function for loadkeyswork and loadkeysfun
function loadkeys {
ssh-add -D
ssh_dir=${1:-~/.ssh/}
echo "getting keys : $ssh_dir"
# ignore directories, ignore public keys, soft links, known hosts and ssh config
ls -F $ssh_dir | grep -v '/$' | grep -vE '.pub$|@$|^known_hosts$|config$' | while read key; do ssh-add -K $ssh_dir/$key; done
}
function loadkeyswork {
led-backlight-osx
loadkeys ~/.ssh/
ssh-add -K ~/.ssh/work/*github
}
function loadkeysworks {
led-backlight-osx
loadkeys ~/.ssh/
ssh-add -K ~/.ssh/work/*github
}
function loadkeysfun {
led-backlight-osx
loadkeys ~/.ssh/personal
}
# get ssl cert expiration information
# sslcheck google.com
function sslcheck {
openssl s_client -servername $1 -connect $1:443 | openssl x509 -noout -dates
}
#### source .rc_bma
# https://github.com/bash-my-aws/bash-my-aws
export PATH="$PATH:$HOME/.bash-my-aws/bin"
source ~/.bash-my-aws/aliases
source ~/.aliases_common
# additional aws aliases and functions
#export PATH="/usr/local/opt/libressl/bin:$PATH"
#export PATH="/usr/local/opt/mysql-client/bin:$PATH"
asdftfi() {
current_version_to_install="$*"
# https://releases.hashicorp.com/terraform/1.0.1/
# https://releases.hashicorp.com/terraform/1.0.2/
last_version_before_arm="1.0.1"
# sort algorithm puts the earliest version first
# ref: https://stackoverflow.com/a/25731924
get_earliest_version=$(printf '%s\n%s' "$last_version_before_arm" "$current_version_to_install" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -1)
# if the version is the same, that means it's below 1.0.1
if [ "$get_earliest_version" = "$current_version_to_install" ]; then
arch="amd64"
else
arch=$(uname -m)
fi
ASDF_HASHICORP_OVERWRITE_ARCH_TERRAFORM="$arch" asdf install terraform "$current_version_to_install"
asdf local terraform "$current_version_to_install"
}
asdftf() {
curdir="$(pwd)"
module="$1"
echo "cd $curdir/$module"
cd $curdir/$module
asdftfi $(terraform-config-inspect "." --json | jq -r '.required_core[0]' | grep -oP '[0-9].*')
echo "terraform ${@:2}"
terraform ${@:2}
cd $curdir
}
export AWS_PAGER=""
export GPG_TTY=$(tty)
export EDITOR=vim
export CHEF_REPO_PATH=$HOME/git/work/chef-repo
export CHEF_SECRET_KEY_PATH=$HOME/.chef/data_bag_key
export RUBYOPT="-W:no-deprecated"
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH=$PATH:~/.kube/plugins/jordanwilson230
alias k=kubectl
# solve old terraform m1 arm issues
export GODEBUG=asyncpreemptoff=1
add-zsh-hook -Uz chpwd(){ source <(tea -Eds) } #tea
#export ASDF_DATA_DIR=`brew --prefix asdf`/
#source $ASDF_DATA_DIR/asdf.sh
source <(kubectl-argo-rollouts completion zsh)