-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotbash_profile
More file actions
executable file
·173 lines (130 loc) · 4.62 KB
/
dotbash_profile
File metadata and controls
executable file
·173 lines (130 loc) · 4.62 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
echo "bash_profile" # for debugging while setting this up
export VAGRANT_DEFAULT_PROVIDER='virtualbox'
export EDITOR="emacs -nw"
if [ $(uname) = "Linux" ]; then
#echo "Linux"
PATH=~/bin:/usr/local/bin:$PATH:
BREW_PREFIX="brew_not_applicable"
BASH_COMPLETION_D="/etc/bash_completion.d/"
source /etc/bash_completion
export KUBECONFIG=~/.kube/config_tclag_de_acc1:~/.kube/config_tclag_de_dev1:~/.kube/config_tclag_de_prd1:~/.kube/config_tclag_dev1
else
#echo "Mac2"
export BASH_SILENCE_DEPRECATION_WARNING=1
PATH=/usr/local/opt/gnu-indent/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gnu-getopt/bin:/usr/local/opt/gawk/bin:/usr/local/bin:~/bin:/usr/local/bin:/usr/local/bin:/opt/homebrew/bin/:$PATH:
export LC_ALL=en_US.UTF-8 # for python click
BASH_COMPLETION_D="/opt/homebrew/bash_completion.d/"
export KUBECONFIG=~/.kube/config_tclag_de_acc1:~/.kube/config_tclag_de_dev1:~/.kube/config_tclag_de_prd1:~/.kube/config_tclag_dev1:~/.kube/config_tools-np.yaml:~/.kube/config_tools-prd.yaml
fi
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
export CLICOLOR=1
# fix the history
export HISTFILESIZE=100000
export HISTSIZE=100000
export HISTIGNORE="&:[ ]*:exit"
shopt -s histappend # append to the history file
shopt -s cmdhist # multiline commands as one history item
# Check for interactive bash and that we haven't already been sourced.
#[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
# use color with grep (set to auto to not color when output to a file or pipe)
#export GREP_OPTIONS='--color=always'
#copy output of last command to clipboard
alias copylast="fc -e -|pbcopy"
# aws completion (required pip install awscli)
complete -C aws_completer aws
#export IBUS_ENABLE_SYNC_MODE=1
#-----------------------------------------------------------------------
# History search
#-----------------------------------------------------------------------
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# for use of aws command line tool
export PATH=~/bin:~/.local/bin:$PATH
#source ${BASH_COMPLETION_D}docker
function dls {
docker container ls
}
function dbash {
docker exec -ti $1 bash
}
function dsh {
docker exec -ti $1 sh
}
function _docker_complete {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
container_names="$(docker container ls | tail -n +2 | awk '{print $NF}')"
#opts = options for command
#if [[ ${cur} == -* ]] ; then
# COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
# return 0
#fi
COMPREPLY=( $(compgen -W "${container_names}" -- ${cur}) )
return 0
}
complete -F _docker_complete dsh
complete -F _docker_complete dbash
function kexec {
if [ $# -eq 1 ]; then
kubectl exec -ti $1 -- bash
elif [ $# -eq 2 ]; then
kubectl exec -ti $1 -c $2 -- bash
else
kubectl exec -ti $*
fi
}
function _k8s_complete {
pod_names="$(kubectl get pods | tail -n+2 | awk '{print $1}')"
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${pod_names}" -- ${cur}) )
return 0
}
# echo -1.5
complete -F _k8s_complete kexec
export RUISNAAM=kaste503
complete -C /Users/kasterma/bin/vault vault
# pip bash completion start
_pip_completion()
{
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
PIP_AUTO_COMPLETE=1 $1 ) )
}
complete -o default -F _pip_completion pip
# pip bash completion end
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
alias nmux='tmux new -s $(basename $PWD)'
function kctx {
kubectl config use-context $1
}
_kube_contexts()
{
local curr_arg;
curr_arg=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "- $(kubectl config get-contexts --output='name')" -- $curr_arg ) );
}
complete -F _kube_contexts kubectx kctx
#function kns {
# kubectl config set-context --current --namespace=$1
#}
_kube_namespaces()
{
local curr_arg;
curr_arg=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "- $(kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}')" -- $curr_arg ) );
}
complete -F _kube_namespaces kns
function kgp {
kubectl get pods $1
}
alias cfssl='docker run -ti --rm -v$(pwd):/apps -w /apps cfssl/cfssl:1.5.0'
alias cfssljson='docker run -ti --rm -v$(pwd):/apps -w /apps --entrypoint=cfssljson cfssl/cfssl:1.5.0'
export CDPATH=.:~:~/projects:/:/workspace
[[ -s ~/.bashrc ]] && source ~/.bashrc
. "$HOME/.cargo/env"