-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
221 lines (174 loc) · 6.59 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
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
shopt -s expand_aliases
export EDITOR=vim
#export PIP_REQUIRE_VIRTUALENV=true
source ~/Tools/dotfiles/git_colors.sh
source ~/Tools/dotfiles/git-completion.bash
source ~/Tools/dotfiles/tmuxinator_completion.bash
source ~/Tools/dotfiles/testkitchen_completion.bash
# History Fix
#export HISTTIMEFORMAT="%y-%m-%d %T " # Set the history datetime format
export HISTCONTROL=ignoredups:erasedups:ignorespace # Deduplicate history entries
export HISTSIZE=250000000 # Save more history in memory
export HISTFILESIZE=100000 # Save more history to the history file
export HISTIGNORE="ls:ps:history"
shopt -s histappend # Set the history serialization to append instead of overwrite
shopt -s cmdhist
# add this configuration to ~/.bashrc
export HH_CONFIG=keywords,hicolor,casesensitive # get more colors
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" # mem/file sync
export HH_CONFIG=keywords,hicolor,casesensitive # get more colors
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" # mem/file sync
export BYOBU_PREFIX=$(brew --prefix)
#drm() { docker rm $(docker ps -q -a); }
#db() { docker build -t="$1" .; }
#dcb() { docker-compose build "$1" ; }
#dri() { docker rmi $(docker images -q); }
# aliases to research
# https://github.com/mathiasbynens/dotfiles/blob/master/.aliases
# Determine most used CLI command
# Use export HISTTIMEFORMAT=""; first if your history displays timestamps.
# history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
# history | tr -s ' ' | cut -d ' ' -f3 | sort | uniq -c | sort -n | tail | perl -lane 'print $F[1], "\t", $F[0], " ", "▄" x ($F[0] / 12)'
# Added 12/16/18
functions() { cd ~/Tools/dotfiles; echo -e "$(cat functions)" | less -R; }
isthere() { if (($(grep -c -m 1 "$1" "$3"))); then echo "YES"; else echo "NO"; fi; }
#
alias ll="ls -lah"
alias tmux="TERM=screen-256color-bce tmux"
alias mux="TERM=screen-256color-bce mux"
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias ln='ln -i'
alias hg='history | grep $1'
#alias dps='docker ps'
#alias rui="docker rmi $(docker images | grep "^<none>" | awk '{print $3}')"
#alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
alias uvp="cd ~/.vim && git submodule update --init && git submodule foreach git pull origin master"
#complete -o default -o nospace -W "$(/usr/bin/env ruby -ne 'puts $_.split(/[,\s]+/)[1..-1].reject{|host| host.match(/\*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" scp sftp ssh rsync
export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
#export PATH="~/Library/Python/2.7/bin:$PATH"
export PATH="$PATH:/usr/local/sbin"
export PATH="~/Tools/git/tfenv/bin:$PATH"
export GOPATH=$HOME/Tools/go_learning
#export GOPATH=$HOME/Tools/go_learning/bin
export PATH="$GOPATH:$PATH"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
#export PATH="/opt/local/bin:$PATH"
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
#export WORKON_HOME=~/Tools/pythonenvs
export WORKON_HOME=~/.virtualenvs
. /usr/local/bin/virtualenvwrapper.sh
#export PATH="$HOME/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# if this is interactive shell, then bind hh to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh -- \C-j"'; fi
#[ -s "/Users/jarrod.pooler/.scm_breeze/scm_breeze.sh" ] && source "/Users/jarrod.pooler/.scm_breeze/scm_breeze.sh"
[ -s "/Users/jpooler/.scm_breeze/scm_breeze.sh" ] && source "/Users/jpooler/.scm_breeze/scm_breeze.sh"
eval "$(rbenv init -)"
export PATH="/opt/chefdk/bin:$PATH"
export KITCHEN_YAML=.kitchen.yml
export KITCHEN_LOCAL_YAML=.kitchen.dokken.yml
export PATH="$HOME/.rbenv/bin:$PATH"
# Export for mysql client CLI
export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS
bundle_wrapper() {
for required_file in Gemfile; do
if [[ ! -f ${required_file} ]]; then
echo -e "error: ${required_file} not found; aborting" >&2
return 1
fi
done
if ! command -v bundler >/dev/null 2>&1; then
echo -e "error: \`bundler' not found in ${PATH}; aborting" >&2
return 1
fi
return 0
}
brak() {
bundle_wrapper || return 1
bundle exec rake "${@}"
return $?
}
berc() {
bundle_wrapper || return 1
bundle exec rubocop "${@}"
return $?
}
bekc() {
bundle_wrapper || return 1
bundle exec kitchen converge
return $?
}
be() {
bundle_wrapper || return 1
bundle exec "${@}"
return $?
}
bebi() {
bundle_wrapper || return 1
bundle exec bundle install
return $?
}
bebp() {
bundle_wrapper || return 1
bundle exec build prepare
return $?
}
# Functions we'll use for tfinit, tfplan and tfapply in this repo
function tfinit() {
if [ -z "$1" ]; then
echo "ERROR: Must supply a workspace, such as 'us-east-1'"
echo -e "\nusage: tfinit <workspace>\n"
return 1
fi
# Test if workspace can be used
terraform workspace select "$1" >/dev/null 2>/dev/null
# If it fails, init is required before using any non-default workspace
if [ $? -ne 0 ]; then
# Init may fail on backend and that's okay
terraform init || echo -e "\nINFO: Init with default workspace Completed. The above error is expected. YMMV.\n\n\n"
fi
# Need to switch to desired workspace before init
terraform workspace select "$1"
terraform init
}
function tfplan() {
if [ -z "$1" ]; then
echo "ERROR: Must supply a workspace, such as 'us-east-1'"
echo -e "\nusage: tfplan <workspace>\n"
return 1
fi
var_file="$1.tfvars"
[ ! -f "$var_file" ] && var_file="../$1.tfvars"
[ ! -f "$var_file" ] && var_file="../../$1.tfvars"
tfinit $1 && \
terraform plan -var-file="$var_file" ${@:2}
}
function tfapply() {
if [ -z "$1" ]; then
echo "ERROR: Must supply a workspace, such as 'us-east-1'"
echo -e "\nusage: tfapply <workspace>\n"
return 1
fi
var_file="$1.tfvars"
[ ! -f "$var_file" ] && var_file="../$1.tfvars"
[ ! -f "$var_file" ] && var_file="../../$1.tfvars"
tfinit "$1" && \
[ -f "$2" ] && terraform apply "$2" || terraform apply -var-file="$var_file" ${@:2}
}
#tunnel <Jumphost DNS> <Application port> <Localhost port> <Node tunneling to>
tunnel() {
PROXYHOST=$1
RPORT=$2
LPORT=$3
PASSTHRUHOST=$4
if [ -z $LPORT ]; then
LPORT=$RPORT
fi
if [ -z $PASSTHRUHOST ]; then
PASSTHRUHOST=localhost
fi
ssh $PROXYHOST -L ${LPORT}:$PASSTHRUHOST:${RPORT}
}