-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.aliases
82 lines (69 loc) · 2.04 KB
/
lib.aliases
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
#!bin/bash
# -- aliases -- #
alias ssh='LC_ALL=C ssh'
alias scp='LC_ALL=C scp'
alias rm='rm -i'
alias l='ls -c -h -v -l --color=auto'
alias ll='l -a'
alias p='pwd'
alias h='cd ~'
alias k='cd ..'
alias e='TERM=xterm-256color emacs -nw --no-site-file'
alias clean='rm -f *~ .*~ *.pyc *.pyo \#* .\#*'
alias c='clear'
alias ps='ps auxw --sort=uid,pid,cmd'
alias lps='COLUMNS=9999 ps auxw --sort=uid,pid,cmd'
alias rgrep='grep --color=always -n'
alias mmake='make 2>&1 | more'
alias sudo='sudo '
alias tf="terraform"
function grip-start {
local l_args=""
if [ -n "${GITHUB_TOKEN}" ]; then
l_args="--pass ${GITHUB_TOKEN}"
fi
docker run -d --name $(basename $(pwd))-grip -v $(pwd):/export psycofdj/grip ${l_args}
}
function grip-stop {
docker stop -t0 $(basename $(pwd))-grip
docker rm $(basename $(pwd))-grip
}
function grip-show {
local l_ip=$(docker inspect $(basename $(pwd))-grip -f '{{.NetworkSettings.IPAddress}}')
sensible-browser http://${l_ip} &
}
function docker-ip {
local l_container=$1; shift;
docker inspect ${l_container} -f '{{ range .NetworkSettings.Networks }}{{.IPAddress}}{{ end }}'
}
function __docker-ip_cpl {
# shellcheck disable=SC2034
local cur prev words cword split
_init_completion -s || return
if [ ${cword} -eq 1 ]; then
local l_images=$(docker ps --format '{{ .Names }}')
local IFS=$'\n'
COMPREPLY+=($(compgen -W "${l_images}" -- ${cur}))
fi
}
complete -F __docker-ip_cpl docker-ip
function gogdb() {
local l_file=$1; shift
if [ -z "${l_file}" ]; then
echo "gogdb error: must supply program argument" 2>&1
return 1
fi
local l_script="${GOROOT}/src/runtime/runtime-gdb.py"
if [ ! -f "${l_script}" ]; then
l_script="/usr/local/go/src/runtime/runtime-gdb.py"
if [ ! -f "${l_script}" ]; then
echo "gogdb error: could not find must runtime-gdb.py in GOROOT or /usr/local/go" 2>&1
return 1
fi
fi
gdb "${l_file}" -ex "source ${l_script}"
}
function ergrep() {
local l_bin=$(which grep)
e $(${l_bin} -n "$@" | cut -d: -f1-2 | sort -u)
}