-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
279 lines (236 loc) · 5.46 KB
/
.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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#!/bin/bash
os=$(uname)
env_osx() {
if command -v gls &> /dev/null; then
_ls_command="gls"
else
_ls_command="ls"
fi
case "$_ls_command" in
ls) color='-G' ;;
gls) color="--color=auto" ;;
esac
alias xclip='pbcopy'
}
env_linux() {
color='--color=auto'
}
case "$os" in
Darwin) env_osx ;;
Linux) env_linux ;;
esac
alias l='${_ls_command} -CF ${color}'
alias l.='${_ls_command} -d .*[^.$] ${color} 2>/dev/null'
alias la='${_ls_command} -A ${color}'
alias lah='${_ls_command} -lah ${color}'
alias ls='${_ls_command} ${color}'
alias ll.='${_ls_command} -dl .*[^.$] ${color} 2>/dev/null'
alias ll='${_ls_command} -AlF ${color}'
alias lla='${_ls_command} -AlFh ${color}'
alias h='history'
alias hsr='history | rg '
alias fdi="fd -I"
alias fdip="fd -I --full-path"
alias fdh="fd -HI -E '.git/*'"
alias fdhp="fd -HI -E '.git/*' --full-path"
alias fdp="fd --full-path"
#alias grep='grep --color=auto 2>/dev/null'
#alias grep='ag $*' 2>/dev/null
alias tree='tree -a -I .git'
alias dtree='tree -ad -I .git'
# open file manager cwd
alias e.='nautilus . 2>/dev/null'
#export TERM=xterm-256colors
#export TERM=screen-256colors
#export TERM=gnome-256colors
#export TERM=mate-terminal
# docker
alias d='docker'
alias dm='docker-machine'
docker_select() {
# shellcheck disable=2046
eval $(docker-machine env "$1")
}
alias dms='docker_select'
# brew
alias bi='brew info'
alias bs='brew search'
alias bl='brew list'
alias blr='brew list | rg '
# cat
# alias k='cat'
# alias k='rich'
alias k='gat'
alias cg='cargo'
# overload ag
alias ag='ag --hidden --ignore-dir .git'
# ansible
alias ap='ansible-playbook'
alias ad='ansible-doc'
alias al='ansible-lint'
# gopass
alias p='gopass'
# rsync
alias qcp='rsync -avzh'
# vagrant
alias v='vagrant'
# salt
#alias sc='salt-cloud -c ./salt'
# neovim
alias vi='nvim'
# blind
alias viu='vi -u NONE'
# neovim config
alias vic='nvim ~/.config/nvim/init.lua'
alias luamake=~/.cache/nvim/lspconfig/sumneko_lua/lua-language-server/3rd/luamake/luamake
# loop
alias lo='_lo '
# search dot files
agdf_imp() {
# shellcheck disable=2048,2086,2046,2012
# ag $* $(ls -dFL .* | ag -v "(/)$" | ag -v "(\*)$" | ag -v history)
rg $* $(ls -dFL .* | rg -v "(/)$" | rg -v "(\*)$" | rg -v history)
}
alias agdf='agdf_imp '
rgdf() {
# shellcheck disable=2048,2086,2046,2012
# ag $* $(ls -dFL .* | ag -v "(/)$" | ag -v "(\*)$" | ag -v history)
rg $* $(ls -dFL .* | rg -v "(/|\*|history)$")
}
# dotfile configuration
alias config='git --git-dir=$HOME/.files.git --work-tree=$HOME --no-pager'
alias c='config '
alias ca='config add '
alias cci='config commit -v '
alias ciu='config status -s -u '
alias c.d='config difftool '
# shellcheck disable=1090
[ -f ~/.aliases.local ] && . ~/.aliases.local
# kubernetes
alias xp='crossplane'
alias fls='flux reconcile source git '
alias flh='flux reconcile source helm '
alias flk='flux reconcile kustomization '
# kubernetes
# shellcheck disable=2046,2139
alias kubectl=$( if command -v kubecolor ; then echo kubecolor ; else echo kubectl ; fi)
# compdef kubecolor=kubectl
alias kk='kubectl'
alias kkc='kubectx'
alias kkn='kubens'
alias kko='kubectl get -o name '
kkf() {
kubectl get -o name "$@" | xargs -P 10 kubectl patch -p '{"metadata":{"finalizers": null}}' --type merge
}
# kustomize
alias kit='kustomize build --enable-helm '
kb() {
kustomize build "$@"
}
kc() {
kustomize cfg "$@"
}
kcg() {
kc grep "$@"
}
kct() {
target="$1" ; shift
kustomize cfg tree "$target" "$@"
}
kcte() {
target=$1 ; shift
kct "environments/$target" "$@"
}
alias krp='kc grep'
kbc() {
target=$1 ; shift
kb "$target" | kc grep "$@"
}
kbce() {
target=$1 ; shift
kbc "environments/$target" "$@"
}
kbte() {
target=$1 ; shift
kb "environments/$target" | kct - "$@"
}
kbet() {
target=$1 ; shift
project=$1 ; shift
kbe "$target" "$project" | kct - "$@"
}
kbeta() {
target=$1 ; shift
project=$1 ; shift
kbe "$target" "$project" | kct - --all
}
kbi() {
kbe "$1" "$2" | kcg kind=Ingress
}
kbil() {
kbc "$1" "kind=Ingress"
}
kbile() {
kbil "environments/$1"
}
kbe() {
kbce "$1" "metadata.name=$2"
}
kca() {
kbe "$1" "$2" | kct - --all
}
### nix
###
alias nf='nix flake '
alias ns='nix-search '
# python 3
if [ -z "$IN_NIX_SHELL" ] ; then
alias python=${HOMEBREW_PREFIX}/bin/python3.12
alias pip=${HOMEBREW_PREFIX}/bin/pip3.12
fi
# vifm
alias vf='vifm'
## yabai
# restat yabai quickly
# # ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
# alias reup='launchctl kickstart -k "gui/${UID}/com.koekeishiya.yabai"'
alias reup='yabai --restart-service'
## aerospace
alias as='aerospace '
alias a='aerospace '
# clangd
#alias clangd='/usr/local/Cellar/llvm/10.0.1_1/bin/clangd'
# clear
#
alias cls='clear'
# ssh
##
alias ssh='TERM=xterm-256color ssh '
### tmux
###
alias t='tmux'
alias ta='t a -t'
alias tls='t ls'
alias tn='t new -t'
### jenkins
###
alias js='jen s'
# alias jc='jen co'
### ruby
###
# alias ruby='/usr/local/opt/ruby/bin/ruby'
# alias gem='/usr/local/opt/ruby/bin/gem'
### terraform
###
alias tf='terraform'
alias tfw='tf workspace'
### fun stuff
###
alias wo='command -v'
alias wow='which -a'
alias woa='which -a'
alias we='watchexec'
### zscaler
###
alias start-zscaler="open -a /Applications/Zscaler/Zscaler.app --hide; sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl load {} \;"
alias kill-zscaler="find /Library/LaunchAgents -name '*zscaler*' -exec launchctl unload {} \;;sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl unload {} \;"