-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bashrc
617 lines (501 loc) · 20.7 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
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# .bashrc (Jiri Kremser)
# Source global definitions
[ -f /etc/bashrc ] && source /etc/bashrc
# completions
for f in `find ~/.completion -type f`; do source $f; done
source /usr/share/bash-completion/completions/git
# bash completion working with the 'g' alias
complete -o default -o nospace -F _git g
getSpecialChar() {
#_SPECIAL="👒"
_SPECIAL_GULP="🍄"
_SPECIAL_MVN="λ"
#_SPECIAL="👣"
#_SPECIAL="💊"
#_SPECIAL="💩"
_SPECIAL_NORMAL="💲"
_SPECIAL_DOCKER_COMPOSE="🔨"
_SPECIAL_CODE="λ"
[[ `git rev-parse --is-inside-work-tree 2> /dev/null` ]] && {
d=`pwd`
[[ -s "$d/pom.xml" ]] && {
echo $_SPECIAL_MVN
exit
}
[[ -s "$d/gulpfile.js" ]] && {
echo $_SPECIAL_GULP
exit
}
[[ -s "$d/docker-compose.yaml" ]] || [[ -s "$d/docker-compose.yml" ]] && {
echo $_SPECIAL_DOCKER_COMPOSE
exit
}
echo $_SPECIAL_CODE
exit
}
echo $_SPECIAL_NORMAL
}
localClusterRunning() {
docker ps --no-trunc --format "{{.Command}}" | grep "/usr/bin/openshift start" &> /dev/null && echo "◜" || echo ""
}
#git cmd line branch highlighting
promptText() {
#CODE=$?;
CODE=$1;
CODE_STR="";
GITBRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null);
YELLOW="\[\033[0;33m\]";
BLUE="\[\033[0;34m\]";
LIGHT_BLUE="\[\033[0;36m\]";
RED="\[\033[0;31m\]";
LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]";
LIGHT_GREEN="\[\033[1;32m\]";
WHITE="\[\033[1;37m\]";
LIGHT_GRAY="\[\033[0;37m\]";
NORMAL="\[\033[0m\]";
#CONTAINERS=`docker ps --format "{{.ID}}" | wc -l`
#CONTAINERS=`[ $CONTAINERS != 0 ] && echo "$YELLOW[$NORMAL$CONTAINERS$(localClusterRunning)$YELLOW]$NORMAL " || echo ""`
[ $CODE != 0 ] && CODE_STR="($CODE)";
_SPECIAL=`getSpecialChar`
USERR=`[ "${#USER}" -gt "4" ] && echo $USER | cut -c1-2 || echo $USER`
HOSTT=`[ "$(hostname -s)" == "localhost" ] && echo "local" || echo $(hostname -s)`
PS1="[$USERR@$HOSTT \W $CONTAINERS$GREEN$GITBRANCH$NORMAL]";
PS1="\[\033[G\]$PS1$RED$CODE_STR$NORMAL$_SPECIAL ";
}
#export PROMPT_COMMAND=promptText
#PS1='[\u@\h \W\[\033[0;32m\]$(__git_ps1 " %s")\[\033[00m\]]\$ '
#PS1="\[\033[G\]$PS1"
pick(){
echo $@ | tr ',' '\n' | tr ' ' '\n' | sort -R | head -1
}
#function which(){
# readlink -f $( which $1 )
#}
bcp(){
cp $1{,-$( date +%F )}
}
log(){
less +F $1 |egrep --line-buffered --color=auto 'ERROR|WARN|$' # tail log & highlight errors (if your grep supports --color)
}
alias jctl="journalctl -f"
certAdd(){
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n $1 -i $1
}
#ls
alias ls="ls --color=auto"
alias ll="ls -l"
##### </Maven colors>
# Mvn color (https://gist.github.com/1027800)
# Formatting constants
export BOLD=$(tput bold)
export UNDERLINE_ON=$(tput smul)
export UNDERLINE_OFF=$(tput rmul)
export TEXT_BLACK=$(tput setaf 0)
export TEXT_RED=$(tput setaf 1)
export TEXT_GREEN=$(tput setaf 2)
export TEXT_YELLOW=$(tput setaf 3)
export TEXT_BLUE=$(tput setaf 4)
export TEXT_HAWKULARBLUE=$(tput setaf 39)
export TEXT_MAGENTA=$(tput setaf 5)
export TEXT_CYAN=$(tput setaf 6)
export TEXT_WHITE=$(tput setaf 7)
export TEXT_ORANGE=$(tput setaf 172)
export BACKGROUND_BLACK=$(tput setab 0)
export BACKGROUND_RED=$(tput setab 1)
export BACKGROUND_GREEN=$(tput setab 2)
export BACKGROUND_YELLOW=$(tput setab 3)
export BACKGROUND_BLUE=$(tput setab 4)
export BACKGROUND_MAGENTA=$(tput setab 5)
export BACKGROUND_CYAN=$(tput setab 6)
export BACKGROUND_WHITE=$(tput setab 7)
export RESET_FORMATTING=$(tput sgr0)
# Wrapper function for Maven's mvn command.
mvnColor() {
mvn $@ | sed -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}\1${RESET_FORMATTING}/g" \
-e "/\[INFO\]\ Building\ \(war\:\|jar\:\|ear\:\)/! s/\(\[INFO\]\ Building .*\)/${TEXT_BLUE}\1${RESET_FORMATTING}/g" \
-e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
-e "s/\(\[INFO\]\ BUILD FAILURE\)/${TEXT_RED}\1${RESET_FORMATTING}/g" \
-e "s/\(\[WARNING\].*\)/${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
-e "s/\(\[ERROR\].*\)/${TEXT_RED}\1${RESET_FORMATTING}/g" \
-e "s/\(Caused by: .*\)/${BOLD}${TEXT_ORANGE}\1${RESET_FORMATTING}/g" \
-e "s/\(org\.rhq\..*\)/${BOLD}\1${RESET_FORMATTING}/g" \
-e "s/\(org\.hawkular\..*\)/${BOLD}\1${RESET_FORMATTING}/g" \
-e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
echo -ne ${RESET_FORMATTING}
}
alias m="mvnColor"
##### </Maven colors>
logColor() {
echo $@
[ $# = 0 ] && exit
$@ | sed -e "s/\(\ INFO\ \ .*\)/${RESET_FORMATTING}\1${RESET_FORMATTING}/g" \
-e "s/\(\ WARN\ \ .*\)/${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
-e "s/\(\ ERROR\ .*\)/${TEXT_RED}\1${RESET_FORMATTING}/g" \
-e "s/\(org\.rhq\..*\)/${BOLD}\1${RESET_FORMATTING}/g" \
-e "s/\(org\.hawkular\..*\)/${BOLD}\1${RESET_FORMATTING}/g" \
-e "s/\(Caused by: .*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g"
}
# Make box around text.
box() { t="$1xxxx";c=${2:-=}; echo ${t//?/$c}; echo "$c $1 $c"; echo ${t//?/$c}; }
# make nice commit log output for BugZilla
gll() {
BRANCH=`git rev-parse --abbrev-ref HEAD 2> /dev/null | tr '/' '?'`
git l4-helper | sed -e "s/%REPLACE%/${BRANCH}/" -e "s/\?/\\//"
}
# simple webcam timelapse toolkit
timelapse() {
i=0
while true; do
figlet "Frame: $i"
mplayer tv:// -vo jpeg -frames 1 > /dev/null 2>&1
mv 00000001.jpg img_$(date +%s).jpg
sleep 1
((i++))
done;
}
alias timelapsePreview="mplayer mf://*.jpg"
alias timelapseEncode="mencoder mf://*.jpg -ovc lavc -o out.avi"
#make ~? typo work as ~/
: << 'END'
function cd {
local target="$1"
[[ $target == ~?* ]] && target="~/${target:2}"
eval "builtin cd ${target}"
return $?
}
END
#function vim {
# local target="$1"
# [[ $target == ~?* ]] && target="~/${target:2}"
# eval "/usr/bin/vim ${target}"
# return $?
#}
#melodyping(){ ping $1|awk -F[=\ ] '/me=/{t=$(NF-1);f=3000-14*log(t^20);c="play -q -n synth 0.7s pl " f;print $0;system(c)}';}
#aliases
alias mountPhone="simple-mtpfs --device 1 ~/foo"
# View HTTP traffic
alias sniff="sudo ngrep -d 'em1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i em1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
# <git>
alias g="git "
alias ga="g add -A"
alias gl="g l"
alias gl1="g l1"
alias gg="git g"
alias gst="g st"
alias gs="gst" # sorry, ghost script
alias gpl="g pl"
alias gpll="g pll"
alias gppm="g push personal master"
alias gd="g dif"
alias gdf="gd"
alias gap="g ap"
alias grc="g rc"
alias gra="g ra"
gpr() {
[[ "x$1" == "x" ]] || git fetch origin pull/$1/head:pr$1 && g cd pr$1
}
ggrp() {
[[ $# -lt 2 ]] && echo "usage: ggrp <path_prefix_to_ignore> <search_pattern> [<grep_params>]" && return
to_ignore=$1
shift
to_grep=$1
shift
params=$*
git grep $params "$to_grep" -- `git ls-files | grep -v $to_ignore`
}
gShowPr() {
[[ "x$1" == "x" ]] || git fetch origin pull/$1/head:pr$1 && g cd pr$1
}
gBak() {
local _current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
local _suffix="_bak"
local _candidate="$_current_branch""$_suffix"
while git rev-parse --verify $_candidate &> /dev/null && true ; do
_candidate="$_candidate""$_suffix"
done
git checkout -b $_candidate
echo "branch $_candidate created"
git checkout -
}
personalize() {
G_REMOTE=`git remote -v | head -1 | sed 's;.*\(https://github.com/\)[^/]*\([^\ ]*\).*;[email protected]:jkremser\2;g'` || true
#sed -i'' 's;remote "origin";remote "personal";g' .git/config || true
#sed -i'' 's;https\?://github.com/jkremser;[email protected]:jkremser;g' .git/config || true
g remote add personal $G_REMOTE
}
alias gper="personalize"
#</git>
# general
alias psg='ps aux | grep'
alias untar="tar -xf"
alias untargz="tar -xfz"
# cd
alias ..='cd ..'
alias ...='cd ../../../'
# https://github.com/vigneshwaranr/bd
alias bd=". bd -s"
# safe rm
alias rm='rm --preserve-root'
# netstat
alias ports='netstat -tulanp'
# color cat - https://github.com/jingweno/ccat/releases
alias cat="ccat --bg=dark "
# ignore some patterns during bash completion
export FIGNORE=.bat:.svn
bind 'set match-hidden-files off'
alias dlna="/home/jkremser/install/pms-1.72.0/PMS.sh"
# Start a web service on port 8000 that uses CWD as its document root.
if type ruby &> /dev/null; then
alias share="ruby -run -e httpd . -p 8000"
else
alias share="python -m SimpleHTTPServer"
fi
#Show a count of how many normal files are in the current directory and below.
alias fileNumber="find . -type f | wc -l"
#sudo
alias s=sudo
alias plz=sudo
#yum
alias di="sudo dnf install"
alias ds="sudo dnf search"
alias syslogs='s tail -f -n5 $(find /var/log -name \*log)'
#top on steroids
alias top="htop"
#grep on steroids
alias grp="ag"
# better formatting for mount
alias mountt='mount | column -t'
# Complement to whoami command.
alias whereami='echo "$( hostname --fqdn ) ($(hostname -i)):$( pwd )"'
#alias neco="melodyping"
alias rtfm="echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc"
#play short sounds
alias soundCow="paplay /usr/lib64/libreoffice/share/gallery/sounds/cow.wav"
alias soundHorse="paplay /usr/lib64/libreoffice/share/gallery/sounds/horse.wav"
alias soundTrain="paplay /usr/lib64/libreoffice/share/gallery/sounds/train.wav"
#train
alias train="(soundTrain&/home/jkremser/install/sl/sl)"
#vpn
alias vpnVsup='sudo /etc/init.d/openvpn stop && sleep 1 && sudo cp /etc/openvpn/client.conf_vsup /etc/openvpn/client.conf && sudo /etc/init.d/openvpn start'
alias vpnMzk='sudo /etc/init.d/openvpn stop && sleep 1 && sudo cp /etc/openvpn/client.conf_mzk /etc/openvpn/client.conf && sudo /etc/init.d/openvpn start'
#cert
alias certList="certutil -d sql:$HOME/.pki/nssdb -L" # add '-h all' to see all built-in certs"
# Quick search in a directory for a string
alias search="ack -i "
#rhq
export WORKSPACE="$HOME/workspace"
export RHQ_HOME="$WORKSPACE/rhq"
alias rhq='cd $WORKSPACE/rhq && echo ${TEXT_CYAN} && figlet RHQ && echo ${RESET_FORMATTING} && echo "Current directory is:" && pwd'
alias rhqGui='cd $WORKSPACE/rhq/modules/enterprise/gui/coregui && echo ${TEXT_MAGENTA} && figlet coregui && echo ${RESET_FORMATTING} && echo "Current directory is:" && pwd'
alias rtl="rhqctl"
complete -o default -o nospace -F _rhqctl rtl
sayCWD() {
[[ "x$1" == "x" ]] || echo ${TEXT_HAWKULARBLUE} && figlet -f ~/ogre.flf -m8 $1 && echo ${RESET_FORMATTING} && echo "Current directory is:" && pwd
}
#daikon
alias daikon='cd $WORKSPACE/radanalyticsio && sayCWD radanalytics'
alias radanalytics='daikon'
alias sop='cd $WORKSPACE/jvm-operators/spark-operator && sayCWD spark-op'
alias sap='cd $WORKSPACE/jvm-operators/abstract-operator && sayCWD abstract-op'
opLogs() {
oc logs -f `oc get pod -l app.kubernetes.io/name=spark-operator -o='jsonpath="{.items[0].metadata.name}"' | sed 's/"//g'`
}
#work
alias workScreens='xrandr --output eDP-1 --pos 0x953 --mode 1600x900 --rate 59.99 --output DP-1-2 --pos 1600x462 --mode 1920x1080 --rate 60 --output DP-1-3 --pos 3520x0 --mode 1920x1080 --rate 60 --rotate right'
alias meeting="xrandr --output DP-1-2 --off && xrandr --output DP-1-3 --off"
#hawkular
alias hawk='cd $WORKSPACE/hawkular && sawCWD hawkular'
alias buildHawkular='m -U clean install -DskipTests -Pdev && ./dist/target/hawkular-1.0.0-SNAPSHOT/wildfly-8.2.0.Final/bin/standalone.sh --debug'
alias hawkR='cd $WORKSPACE/hawkular-client-ruby && sayCWD hawkular ruby client'
alias hawkS='cd $WORKSPACE/hawkular/hawkular-services && sawCWD hawkular services'
alias hawkRubyGem='cd $WORKSPACE/hawkular-client-ruby && sayCWD hawkular ruby gem'
#MiQ
alias miq='cd $WORKSPACE/manageiq && sayCWD MiQ'
alias miqUi='cd $WORKSPACE/manageiq/plugins/manageiq-ui-classic && sayCWD MIQ UI'
#other
alias hawkin='cd $WORKSPACE/hawkular/hawkinit && sayCWD hawkinit'
alias hawkfly='cd $WORKSPACE/hawkfly-domain-dockerfiles && sayCWD docker stuff'
alias runHawkS="hawkS && cd dist && m clean install -DskipTests -Pdev && ./target/hawkular-*/bin/standalone.sh -Dhawkular.log.cassandra=WARN -Dhawkular.log.inventory.rest.requests=DEBUG -Dhawkular.rest.user=jdoe -Dhawkular.rest.password=password -Dhawkular.agent.enabled=true"
alias runHawkSA="runHawkS -Dhawkular.agent.enabled=false"
alias buildRest="hawk && cd hawkular/modules/hawkular-api-parent && m clean install -Pdev -DskipTests"
alias runHawkAgentless="runHawk -Dhawkular.agent.enabled=false"
alias runHawkBusless="runHawkAgentless -Dinventory.bus.integration=false"
alias buildInv="hawk && cd hawkular-inventory && m clean install -DskipTests"
alias runCli="$RHQ_HOME/modules/enterprise/remoting/cli/target/rhq-remoting-cli-$RHQ_VERSION-SNAPSHOT/bin/rhq-cli.sh"
alias runCliLogin="runCli --user rhqadmin --password rhqadmin"
alias tailf="tail -f"
alias ctailf="logColor tailf"
alias agentLog="logColor tail -f $RHQ_AGENT_INSTALL_DIR/logs/agent.log"
alias serverLog="logColor tail -f $RHQ_HOME/dev-container/rhq-server/logs/server.log"
alias pj='ps ax | grep java'
alias psj='pj'
alias killCassandra='kill -9 $(ps ax | grep cassandra | grep java | awk '\''{print $1}'\'')'
alias killAgent='kill -9 $(ps ax | grep AgentMain | grep java | awk '\''{print $1}'\'')'
alias killServer='kill -9 $(ps ax | grep rhq-server.properties | grep java | awk '\''{print $1}'\'')'
alias killRhq='killAgent; killCassandra; killServer'
alias killHawk='kill -9 $(ps ax | grep "standalone/log/server.log" | grep java | awk '\''{print $1}'\'')'
alias runMiq='bundle exec rake evm:start && bundle exec rails s'
alias webcam="ssh [email protected] -Y 'mplayer tv://device=/dev/video0'"
alias microphone="arecord -f dat | ssh -C [email protected] aplay -f dat"
alias hist="history -r; history"
#env
#history on steroids
export HISTCONTROL="ignoreboth" #ignoreboth will ignore consecutive dups and commands starting with space
export HISTTIMEFORMAT="${TEXT_BLUE}%F %T${RESET_FORMATTING} "
export HISTIGNORE="hist*:ls:pwd:g l:g st:g dif:rhq:rhqGui:runPostgres:bash"
export HISTSIZE="1000000"
export HISTFILESIZE="1000000"
_bash_history_sync() {
CODE=$?
builtin history -a #1
HISTFILESIZE=$HISTSIZE #2
builtin history -c #3 comment out 3 and 4 if you don't want to share last commands across terminal sessions
builtin history -r #4
promptText $CODE
}
history() {
_bash_history_sync
builtin history "$@"
}
function histgrep() { fc -l -$((HISTSIZE-1)) | egrep "$@" ;}
function topCmd() { history | awk '{ print $4 }' | sort | uniq -c | sort -rn | head $@;}
alias top10="topCmd"
alias top20="topCmd -20"
alias top50="topCmd -50"
alias vbash="vim ~/.bashrc"
alias vibash="vbash"
alias vimbash="vbash"
alias work="ssh vps@vps 'ssh pi@pi raspistill --timeout 1 -o i.jpg && scp pi@pi:i.jpg .' && scp vps@vps:i.jpg . && eog i.jpg ; rm i.jpg"
alias workVpn="ssh pi@pi raspistill --timeout 1 -o i.jpg && scp pi@pi:i.jpg . && eog i.jpg ; rm i.jpg"
alias workNight="ssh vps@vps 'ssh pi@pi raspistill --timeout 2000 -ex night -o i.jpg && scp pi@pi:i.jpg .' && scp vps@vps:i.jpg . && eog i.jpg ; rm i.jpg"
alias workNightVpn="ssh pi@pi raspistill --timeout 2000 -ex night -o i.jpg && scp pi@pi:i.jpg . && eog i.jpg ; rm i.jpg"
#docker
alias d="docker"
complete -F _docker d
alias dc="docker-compose"
complete -F _docker_compose dc
alias bu="sudo buildah"
complete -F _buildah bu
#openshift
alias woc="watch oc get pods"
alias ocUp="oc cluster up --base-dir=~/tmp/"
alias watch="watch "
#kubectl
source /etc/bash_completion
command -v kubectl &> /dev/null && source <(kubectl completion bash | sed 's/kubectl/kc/g')
command -v kubectl &> /dev/null && source <(kubectl completion bash)
alias kc="kubectl"
#complete -F _kubectl kc
#helper for removing all the docker mess, or just use `docker system prune`
dockerCleanup(){
d kill `d ps -aq`
d rm -f `d ps -aq`
d rmi -f `d images -qa`
d volume rm `d volume ls -q`
d network rm `d network ls -q`
# removing images that can't be removed ("Error response from daemon: reference does not exist")
sudo rm -Rf /var/lib/docker/image/devicemapper/imagedb/content/sha256 && sudo mkdir /var/lib/docker/image/devicemapper/imagedb/content/sha256
# this helps if it's saying the port is already allocated even though it's not
sudo rm /var/lib/docker/network/files/*
sudo systemctl restart docker
}
alias dCleanup="dockerCleanup"
alias ap="ansible-playbook"
PROMPT_COMMAND=_bash_history_sync
shopt -s histappend # append to history, don't overwrite it
shopt -s histreedit # reedit a history substitution line if it failed
shopt -s histverify # edit a recalled history line before executing
#PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" # Save and reload the history after each command finishes
# don't complete if there is no command
# shopt -s no_empty_cmd_completion
export EDITOR="vim"
export GREP_COLOR="0;31"
type most &> /dev/null && export PAGER="most"
# wrap the text content on the screen
#export LESS="-FerX"
# syntax highlight in less (assumes the source-highlight package to be installed)
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '
#JAVA_HOME
[[ "x$JDK_VER" == "x6" ]] && export JAVA_HOME="$HOME/install/jdk1.6.0_45"
[[ "x$JDK_VER" == "x7" ]] && export JAVA_HOME="$HOME/install/jdk1.7.0_79"
[[ "x$JDK_VER" == "x8" ]] && export JAVA_HOME="$HOME/install/jdk1.8.0_181"
[[ "x$JDK_VER" == "x87" ]] && export JAVA_HOME="$HOME/install/jdk1.8.0_74"
[[ "x$JDK_VER" == "x" ]] && export JAVA_HOME="$HOME/install/jdk1.8.0_181"
#export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk"
# simple jdk switcher
jdk() {
[[ "x$1" == "x6" ]] && echo "jdk 6" && JDK_VER="6" bash
[[ "x$1" == "x7" ]] && echo "jdk 7" && JDK_VER="7" bash
[[ "x$1" == "x8" ]] && echo "jdk 8" && JDK_VER="87" bash
[[ "x$1" == "x" ]] && echo "no jdk version specified, defaults to jdk 8" && JDK_VER="8" bash
}
alias profilingOn="export JAVA_OPTS=\"$JAVA_OPTS -Djboss.modules.system.pkgs=com.jprofiler -agentlib:jprofilerti=port=8849 -Xbootclasspath/a:/home/jkremser/install/jprofiler9/bin/agent.jar\" export LD_LIBRARY_PATH=\"/home/jkremser/install/jprofiler9/bin/linux-x64\""
alias profilingOff="export JAVA_OPTS=\"\" export LD_LIBRARY_PATH=\"\""
export M2_HOME="$HOME/install/apache-maven-3.5.4"
export MAVEN_OPTS="-Xms256M -Xmx768M -XX:ReservedCodeCacheSize=96M"
# add permgen jvm options for jdk 7 and lower
[[ $("$JAVA_HOME/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}') > "1.8" ]] || export MAVEN_OPTS="$MAVEN_OPTS -XX:PermSize=128M -XX:MaxPermSize=256M"
export FORGE_HOME="$HOME/install/forge"
export SBT_OPTS="-Xms1336m -Xmx1336m"
export CUDA_HOME="/usr/local/cuda"
# <$PATH stuff>
_addToPath() {
if [[ $# != 1 ]] && [[ $# != 2 ]]; then
echo "Usage: _addToPath /bin/foo" && exit
fi
local _to_add=$1
# must be a directory, must be an absolute path, $PATH must not contain it
if [[ -d "${_to_add}" ]] && [[ "${_to_add}" = /* ]] && [[ $PATH != *":${_to_add}:"* ]]; then
if [[ $# != 2 ]]; then
export PATH="$PATH:$_to_add"
else
export PATH="$_to_add:$PATH"
fi
fi
}
_addToPath "$HOME/install/mx-5.247.4"
_addToPath "$HOME/install/spark-2.4.0-bin-hadoop2.7/bin"
_addToPath "$JAVA_HOME/bin" "true"
_addToPath "$M2_HOME/bin"
_addToPath "$WORKSPACE/miq-helpers"
_addToPath "$HOME/.rvm/bin"
_addToPath "$HOME/install/sbt-launcher-packaging-0.13.13/bin"
_addToPath "$WORKSPACE/radanalyticsio/istio/istio-0.3.0/bin"
_addToPath "$HOME/install/bitcoin-0.14.2/bin"
_addToPath "/bin"
_addToPath "/usr/bin"
#_addToPath "$CUDA_HOME/bin"
#_addToPath "/usr/lib64/nvidia-bumblebee"
#_addToPath "$HOME/.rvm/bin" "toTheBegining"
#_addToPath "/bin/foo"
HADOOP_HOME="/home/jkremser/install/hadoop-2.2.0"
_addToPath "$HADOOP_HOME/bin"
# </$PATH stuff>
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=localhost";
# C*
export MAX_HEAP_SIZE="512M"
export HEAP_NEWSIZE="128M"
export GOPATH=/home/jkremser/install/go-workspace
export WINEARCH=win32
# added by travis gem
[ -f /home/jkremser/.travis/travis.sh ] && source /home/jkremser/.travis/travis.sh
#. ~/.personal.sh
#. ~/.ruby-fu.sh
#source <(oc completion bash)
#export VAGRANT_DEFAULT_PROVIDER=virtualbox
export GOPATH=$HOME/go
_addToPath "$GOPATH/bin/"
MINISHIFT_ENABLE_EXPERIMENTAL=y
export KUBECONFIG=/home/jkremser/.kube/config
export GRAALVM_HOME=/home/jkremser/install/graalvm-ee-19.2.1
_addToPath "$GRAALVM_HOME/bin/"
_addToPath "$HOME/.krew/bin"
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:/usr/lib64/nvidia-bumblebee/"
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:/home/jkremser/install/cuda-cdnn-5:/usr/lib64/nvidia-bumblebee/"
#export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:$HOME/NVIDIA_CUDA-9.0_Samples/common/inc"
#export CUDNN_PATH="/usr/local/cuda/lib64/libcudnn.so.5.1.10"
#. /home/jkremser/torch/install/bin/torch-activate
. "$HOME/.cargo/env"