-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bash_alias
More file actions
executable file
·183 lines (160 loc) · 4.67 KB
/
.bash_alias
File metadata and controls
executable file
·183 lines (160 loc) · 4.67 KB
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
#!/bin/bash
alias s=source
git_current_branch() {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2>/dev/null)
local ret=$?
if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2>/dev/null) || return
fi
echo ${ref#refs/heads/}
}
nv() {
if [[ -n "$1" ]]; then
nvim "$1"
else
local drr
drr=$(fd --type d | fzf)
nvim "$drr"
fi
}
#alias nv='nvim'
alias v='vim'
alias c='cat'
alias g=git
alias gcl='git clone'
alias ga='git add'
alias ga.='git add .'
#alias gb='git branch'
alias gcm='git commit -m'
alias gcb='git checkout -b'
#alias gco='git checkout'
alias gcp='git cherry-pick'
alias gfa='git fetch -a'
alias ggpull='git pull origin $(git_current_branch)'
alias ggpush='git push origin $(git_current_branch)'
alias gpushf='git push --force origin $(git_current_branch)'
alias gpull='git pull'
#alias glo='git log --oneline'
alias gm='git merge'
alias gpush='git push'
#alias grb='git rebase $(gb)'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
#alias grbi='git rebase -i'
alias grbm='git rebase master'
alias grh='git reset --hard'
alias grs='git reset --soft HEAD~1'
alias gst='git status'
alias gtls='git tag -l --sort=v:refname | tail -n 3'
alias k='kubectl'
alias kgp='kubectl get pod'
alias kgd='kubectl get deployment'
alias kgi='kubectl get ingress'
alias kgs='kubectl get secret'
alias kgcm='kubectl get configmap'
alias kc='kubectx'
alias kns='kubens'
#alias klf='kubectl logs -f $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
klf() {
if [ -n "$1" ]; then
kubectl logs -f "$1"
else
kubectl logs -f $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
#alias kdp='kubectl describe pods $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
kdp() {
if [ -n "$1" ]; then
kubectl describe pods "$1"
else
kubectl describe pods $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
#alias kdlp='kubectl delete pod $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
kdlp() {
if [ -n "$1" ]; then
kubectl delete pod "$1"
else
kubectl delete pod $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
#alias kdld='kubectl delete deployment $(echo $(kgd | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
kdld() {
if [ -n "$1" ]; then
kubectl delete deployment "$1"
else
kubectl delete deployment $(echo $(kgd | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
#alias kes='kubectl edit secrets $(echo $(kgs | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
kes() {
if [ -n "$1" ]; then
kubectl edit secrets "$1"
else
kubectl edit secrets $(echo $(kgs | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
#alias kexe='kubectl exec -it $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1) -- bash'
kexe() {
if [ -n "$1" ]; then
kubectl exec -it "$1" -- bash
else
kubectl exec -it $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1) -- bash
fi
}
#alias kecm='kubectl edit configmap $(echo $(kgcm | sed "1d" | fzf) | head -n1 | cut -d " " -f1)'
kecm() {
if [ -n "$1" ]; then
kubectl edit configmap "$1"
else
kubectl edit configmap $(echo $(kgcm | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
krd(){
if [ -n "$1" ]; then
kubectl rollout restart deployment "$1"
else
kubectl rollout restart deployment $(echo $(kgd | sed "1d" | fzf) | head -n1 | cut -d " " -f1)
fi
}
kpf(){
port=$1
kubectl port-forward $(echo $(kgp | sed "1d" | fzf) | head -n1 | cut -d " " -f1) $port
}
alias yss='yay -Ss'
alias ys='yay -S'
alias yRns='yay -Rns'
alias pSyu='sudo pacman -Syu'
alias dc='docker'
alias dpsa='docker ps -a'
alias dil='docker image ls'
alias dcl='docker container ls'
alias dcla='docker container ls -a'
alias dirm='docker images | sed '1d' | fzf -m | awk '{print $3}' | xargs docker rmi'
alias dcrm='docker ps -a | sed '1d' | fzf -m | awk '{print $1}' | xargs docker rm -v'
alias dthanos='docker system prune -f --all --volumes'
get_container() {
kgp -o jsonpath='{range .items[*].status.containerStatuses[*]}{.name}{"\n"}{end}' | fzf
}
st() {
if [[ -n "$1" ]]; then
stern --tail 20 "$1" --exclude-container "istio-\w"
else
stern --tail 20 $(get_container) --exclude-container "istio-\w"
fi
}
kst() {
if [[ -n "$1" ]]; then
kubectl-stern --tail 20 "$1" --exclude-container "istio-\w"
else
kubectl-stern --tail 20 "$(echo "$(kgp | sed "1d" | fzf -m)" | awk '{print $1}' | paste -sd '|')" --exclude-container "istio-\w"
fi
}
jwtd() {
if [[ -x $(command -v jq) ]]; then
jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' <<< "${1}"
echo "Signature: $(echo "${1}" | awk -F'.' '{print $3}')"
fi
}