-
Notifications
You must be signed in to change notification settings - Fork 8
/
.bashrc
93 lines (73 loc) · 2.26 KB
/
.bashrc
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
CWD=$(dirname ${BASH_SOURCE[0]})
hash kubectl 2>/dev/null
HAS_K8S=$?
if [[ ${HAS_K8S} -eq 0 ]]; then
BREW_PREFIX=$(brew --prefix)
# Kubernetes
KC=(~/.kube/config*)
IFS=: eval 'export KUBECONFIG=${KC[*]}'
KUBE_PS1=${BREW_PREFIX}/share/kube-ps1.sh
if [[ -r ${KUBE_PS1} ]]; then
source ${KUBE_PS1}
kubeoff
fi
source <(kubectl completion bash)
if [[ $(type -t compopt) = "builtin" ]]; then
complete -o default -F __start_kubectl k
else
complete -o default -o nospace -F __start_kubectl k
fi
if [ -f ${BREW_PREFIX}/etc/bash_completion ]; then
. ${BREW_PREFIX}/etc/bash_completion
fi
fi
# Polyglot prompt (needs to go after kube-ps1 is loaded)
POLYGLOT=${CWD}/addons/polyglot/polyglot.sh
if [[ -f ${POLYGLOT} ]]; then
source ${POLYGLOT}
bind 'set show-mode-in-prompt off'
if [[ ${HAS_K8S} -eq 0 ]]; then
POLYGLOT_KUBE=${CWD}/addons/polyglot-kube-ps1/polyglot-kube-ps1.sh
[[ -f ${POLYGLOT_KUBE} ]] && source ${POLYGLOT_KUBE}
fi
fi
export KUBECTX_IGNORE_FZF=true
export KUBE_PS1_SYMBOL_ENABLE=true
export KUBE_PS1_CTX_COLOR=yellow
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
# Git completion
source ${CWD}/.git-completion.sh
# Environment variables
export EDITOR=vi
export GPG_TTY=$(tty)
# Aliases
alias ls='ls -G'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias targ='tar xvzf'
alias tarb='tar xvjf'
alias sshi='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias scpi='scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias ..='cd ..'
alias p='ps aux | grep -i'
alias mvn='mvn -fae'
alias mvncp='mvn clean package'
alias mvnci='mvn clean install'
alias k='kubectl'
alias ki='kubectl -n istio-system'
alias kc='kubectl --kubeconfig'
alias kctx='kubectx'
alias kns='kubens'
alias kshell='kubectl run tmp-shell --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
function kctxd() {
kubectl config delete-context ${1}
kubectl config delete-user ${1}
kubectl config delete-cluster ${1}
}
alias tf='terraform'
# Decode JWT tokens
alias jwtd="jq -R 'split(\".\") | .[0],.[1] | @base64d | fromjson'"
function gitgomod() {
TZ=UTC git --no-pager show --quiet --abbrev=12 --date='format-local:%Y%m%d%H%M%S' --format="%cd-%h"
}