forked from totallyGreg/home
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
137 lines (118 loc) · 6.01 KB
/
.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
## Beginning of Aliases
# if [ ! ${machine} == "Mac" ]; then alias ls='ls --color=auto' ; fi
# if [ ! ${CLICOLOR} == "1" ]; then alias ls='ls --color=auto' ; fi
alias l='ls -lhF'
alias ll='ls -lhF'
alias l1='ls -1'
alias la='ls -alhF'
alias lt='ls -alhFtr'
alias grep='grep --color=auto'
alias cd..='cd ..'
alias ic='cd ~/Library/Mobile\ Documents/com~apple~CloudDocs'
alias watch='watch ' # this allows alias expansion
# alias fuck='sudo $(history -p \!\!)'
# if [ -e (which bat) ]; alias cat='bat --theme TwoDark'
# Python source venv
alias sv='source venv/bin/activate'
# Docker
alias d='docker'
alias dkl='docker logs'
alias dklf='docker logs -f'
alias dki='docker images'
alias dks='docker service'
alias dkrm='docker rm'
alias dm='docker-machine'
alias dmx='docker-machine ssh'
alias docker-ips='docker ps | tail -n +2 | while read -a a; do name=${a[$((${#a[@]}-1))]}; echo -ne "$name\t"; docker inspect $name | grep IPAddress | cut -d \" -f 4; done'
alias dkps="docker ps --format '{{.ID}} - {{.Names}} - {{.Status}} - {{.Image}}'"
# Git
alias g='git '
alias gfa='git fetch --all '
alias gpf='git pull --ff-only '
# GPG
alias gpg_clear_cache='echo "CLEAR_PASSPHRASE --mode=normal $keygrip " | gpg-connect-agent'
# Lima
alias lctl='limactl'
# Kubernetes
alias busybox='kubectl run -it --rm --restart=Never busybox --image=busybox sh'
alias netshoot='open https://github.com/nicolaka/netshoot ; kubectl run tmp-shell --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
alias k='kubectl '
alias ka='kubectl apply -f '
alias kctx='kubectx '
alias kns='kubens '
alias kedp='kubectl get endpoints --all-namespaces '
alias kg='kubectl get '
alias kl='kubectl logs '
alias kpod='kubectl get pods --all-namespaces'
alias ksvc='kubectl get services --all-namespaces'
alias kvu="kubectl view-utilization "
alias kx='kubectl exec -i -t'
alias qapla='pbpaste | kubectl apply -f -'
## Terraform
alias tf=terraform
## Tmux stuff
alias t="tmux "
alias ta="t a -t"
alias tls="t ls"
alias takeover="tmux detach -a"
## Vagrant Stuff
alias vgs='vagrant global-status'
alias v='vagrant'
alias vim=nvim
## Random Crap
# https://apple.stackexchange.com/questions/348762/how-to-have-a-random-background-color-in-terminal-app
alias dark_mode_toggle="osascript -e 'tell application \"System Events\" to tell appearance preferences to set dark mode to not dark mode' -e 'tell application \"Terminal\" to set current settings of window 1 to settings set \"Totally Dark\"'; vim -c Tmuxline +qall"
# alias dark_mode_toggle="osascript -e 'tell application \"System Events\" to tell appearance preferences to set dark mode to not dark mode'"
alias gn='growlnotify'
alias backscreen='/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &'
alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
alias screensaver='open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'
alias ttop='top -ocpu -R -F -s 2 -n30'
alias mtop='top -o rsize'
alias quick='open /Applications/Ops/Administration/Quicksilver.app'
alias futurama='fortune ~/Clouds/iCloud/Bookshelf/Quotes/futurama'
alias serialscreen='screen -L /dev/cu.usbserial -f 9600,cs8,-parenb,-cstopb,-hupcl'
alias odiff='opendiff'
alias flushDNS='sudo killall -HUP mDNSResponder;say DNS cache has been flushed'
alias debugDNS='sudo killall -USR1 mDNSResponder; sudo syslog -C mDNSResponder -d'
alias weakssh='ssh -o StrictHostKeyChecking=no '
alias chrome='open -a "Google Chrome" '
alias test_portal='open http://captive.apple.com/hotspot-detect.html'
alias local_rsync='rsync -av -e rcp --delete --progress '
alias books='~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books'
alias audiobooks='/Users/totally/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/Audiobooks'
alias oblique="curl -s http://brianeno.needsyourhelp.org/draw | jq .strategy"
alias dad_joke='curl -H "Accept: text/plain" https://icanhazdadjoke.com/'
# Read Log files with embeded control characters (e.g. screenlog.0)
alias readlog='less -raw-control-chars'
##### Dotfile management through git work-tree
alias dotadm='git --git-dir=$HOME/.home/ --work-tree=$HOME $@'
alias dadm='dotadm'
alias dotupgrade='dotadm submodule update --remote --merge'
# Generate random mac address for wireless
alias random-mac="openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether"
# Setting sensitive values via security
alias get_pivnet_token='PIVNET_TOKEN=$(ACCOUNT="[email protected]" keychain-environment-variable "Pivotal Refresh Token"); export PIVNET_TOKEN'
#
# ### alias completion functions do not work as they seem to depend on bash 4.1
# https://brbsix.github.io/2015/11/23/perform-tab-completion-for-aliases-in-bash/
# Now sourcing this https://superuser.com/questions/436314/how-can-i-get-bash-to-perform-tab-completion-for-my-aliases
if [ "${BASH_VERSINFO:-0}" -ge 4 ]; then
source ~/._alias_completion
else
true
# echo "bash does not support associative arrays"
fi
#
### Aliases that require a network kept afterwards to it doesn't stall the ._alias_completion funciton
alias morbotron="curl -s https://morbotron.com/api/random | jq --raw-output '.Subtitles[] .Content'"
alias dict='curl dict://dict.org/d:$1'
alias excuse='nc towel.blinkenlights.nl 666'
alias starwars='nc towel.blinkenlights.nl 23'
alias git_home='curl https://gist.githubusercontent.com/totallyGreg/4c9a430e6965280a60fcec628e1d03d5/raw | bash'
alias install_home_brew='/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
alias restart_dns='ssh portcullis sudo /etc/init.d/dnsmasq force-reload'
alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt m4b-tool'
alias mp4chaps='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt --entrypoint mp4chaps m4b-tool'
alias mp4tags='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt --entrypoint mp4tags m4b-tool'
alias mp4info='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt --entrypoint mp4info m4b-tool'