-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases
121 lines (104 loc) · 3.85 KB
/
.bash_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
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
genpasswd() {
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 14 | tr -d '\n'; echo
}
genpwentry() {
read -sp "Passsord: " PW
read -sp "Salt: " SALT
export PW
export SALT
perl -e 'print crypt($ENV{PW},"\$6\$".$ENV{SALT}."\$") . "\n"'
unset PW
unset SALT
}
function docdate () {
f="$1"
d="${2:-now}"
iso="$(date -d "$d" -Iseconds|sed -e 's/[-+][0-9]*$//')"
unzip -p "$f" meta.xml |
sed -e "s,<meta:creation-date>[^<]*,<meta:creation-date>${iso}," >meta.xml &&
zip "$f" meta.xml
rm -f meta.xml
}
alias llth='ls -lt | head'
alias unknown='ssh-keygen -R'
# ----------------------
# Git Aliases
# ----------------------
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add --all'
alias gau='git add --update'
alias gb='git branch'
alias gbd='git branch --delete '
alias gc='git commit'
alias gcm='git commit --message'
alias gcf='git commit --fixup'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcom='git checkout master'
alias gcos='git checkout staging'
alias gcod='git checkout develop'
alias gd='git diff'
alias gda='git diff HEAD'
alias gi='git init'
alias glg='git log --graph --oneline --decorate --all'
alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
alias gm='git merge --no-ff'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gr='git rebase'
alias gs='git status'
alias gss='git status --short'
alias gst='git stash'
alias gsta='git stash apply'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash save'
# ----------------------
# Git Functions
# ----------------------
# Git log find by commit message
function glf() { git log --all --grep="$1"; }
# -------
# ssh tunnel alias
# -------
alias sshtun='~/bin/ssh-tunnel-manager.sh --config ~/bin/ssh-tunnel-manager.conf'
# --------
# cisco specific
# --------
alias awsjump='ssh -J heimdall -A ${1}'
alias gitlab='ssh -i ~/.ssh/id_rsa -T -L 8088:gitlab.tgsre.net:8088 [email protected]'
alias gitlabssh='ssh -i ~/.ssh/id_rsa -T -L 20022:gitlab.tgsre.net:22 [email protected]'
alias esm1='ssh -i ~/.ssh/id_rsa -T -L 29200:es-master-1.tgsre.net:9200 [email protected]'
alias esk1='ssh -i ~/.ssh/id_rsa -T -L 25601:es-master-1.tgsre.net:5601 [email protected]'
alias mount_ui01fs='sshfs -o idmap=user [email protected]: /opt/Data/Cisco/mounts/hunt-ui-01'
# local directory aliases
alias cd-ci="cd /opt/Data/Cisco"
alias cd-ne="cd /opt/Data/Personal/NextCloud"
alias cd-it="cd /opt/Data/Personal/NextCloud/Documents/IT"
alias cd-fi="cd /opt/Data/Personal/NextCloud/Documents/Finance"
alias cd-acct="cd /opt/Data/Personal/NextCloud/Documents/Finance/accounting"
alias cd-itc="cd /opt/Data/Personal/NextCloud/Documents/IT\ Clients"
alias cd-rpg="cd /opt/Data/Personal/NextCloud/Documents/IT\ Clients/RPG"
alias cd-so="cd /opt/Data/Software"
#alias tmux="tmux -u"
alias tmux="tmux -u"
#alias tmux="systemd-run --scope --user tmux -u "
# docker related
# # get all docker IPs
alias dcips=$'docker inspect -f \'{{.Name}}-{{range $k, $v := .NetworkSettings.Networks}}{{$k}}-{{.IPAddress}} {{end}}-{{range $k, $v := .NetworkSettings.Ports}}{{ if not $v }}{{$k}} {{end}}{{end}} -{{range $k, $v := .NetworkSettings.Ports}}{{ if $v }}{{$k}} => {{range . }}{{ .HostIp}}:{{.HostPort}}{{end}}{{end}} {{end}}\' $(docker ps -aq) | column -t -s-'
# docker compose shortcut alias
alias dcp='docker-compose -f ~/docker-compose.yml '
# Tail last 50 lines of docker logs
alias dtail='docker logs -tf --tail='50' '
# Remove unused images (useful after an upgrade)
alias dprune='docker image prune'
# Remove unused images, unused networks *and data* (use with care)
alias dprunesys='docker system prune --all'
alias lth='ls -alt | head'
alias llt='ls -alt'
alias lthh='ls -alth | head'
alias dm='sudo dmesg --time-format iso'