-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
189 lines (147 loc) · 6.37 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
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
#!/usr/bin/env bash
# colored ls
# alias ls='colorls --sd --gs'
# some more ls aliases
alias ll='ls -alhF'
alias la='ls -A'
alias l='ls -CF'
alias ls='ls -a -lrth'
alias lsd='ls -a -lrth -d */'
alias lth='du -sh * | sort -h'
alias lcount='find . -type f | wc -l'
alias lswatch='watch ls -a -ltrh -C'
alias grep='grep --color=auto'
alias clear='clear; echo; echo; seq 1 $(tput cols) | sort -R | spark | lolcat; echo; echo'
alias c="clear"
alias x="exit"
alias mkdir="mkdir -p"
alias rmd='rm -r'
alias ~="cd ~"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ddownload="cd ~/Downloads"
alias ddesktop="cd ~/Desktop"
alias ddotfiles="cd ~/dotfiles"
alias dapps="cd ~/Apps"
alias dsource="cd ~/Source"
alias dhistory="cd ~/history_logs"
## Pipe Aliases (Global)
alias -g L='|less'
alias -g G='|grep'
alias -g T='|tail'
alias -g H='|head'
alias -g W='|wc -l'
alias -g S='|sort'
function __pbcopy_f(){ cat $1 | pbcopy; }
alias pbcopy_f='__pbcopy_f'
alias cpv='rsync -ah --info=progress2'
alias chmox='chmod +x'
alias gclone='git clone'
alias weather='curl wttr.in'
alias party.live='curl parrot.live'
alias partys.live='curl parrot.live --max-time 2'
alias party="imgcat ~/parrot.gif"
alias doodles.cheers="docker run -it --rm docker/doodle:cheers2019"
alias doodles.birthday="docker run -it --rm docker/doodle:birthday2019"
alias doodles.halloween="docker run -it --rm docker/doodle:halloween2019"
alias doodles.summer="docker run -it --rm docker/doodle:summer2019"
function __hdi(){ howdoi $* -c -n 5; }
alias h='__hdi'
function __makecpp(){ g++ $1 -o $2; }
alias makecpp='__makecpp'
alias sdump='genact -m memdump'
#alias scrcpy='docker run --rm -i -t --privileged --name satnami-scrcpy -v /dev/bus/usb:/dev/bus/usb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY pierlo1/scrcpy:intel'
alias scrcpy='scrcpy -m 1920 -S'
alias pubkey="cat ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
alias pubkey_gen_pem"ssh-keygen -f ~/.ssh/id_rsa.pub -m 'PEM' -e > ~/.ssh/id_rsa_pkcs8.pem"
alias pubkey_gen_pem8"ssh-keygen -f ~/.ssh/id_rsa.pub -m 'pkcs8' -e > ~/.ssh/id_rsa_pkcs8.pem"
alias top='htop'
alias file_manager='mc'
alias fm='nnn'
alias httpt='wuzz'
alias diffchecker='diffchecker --expires day'
alias duplicates='echo "Start finding duplicates" && find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD'
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
alias path='echo $PATH | tr -s ":" "\n"'
alias reload="exec $SHELL"
# Add an "alert" alias for long running commands. Use like so: `sleep 10; alert`
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Bell when the program is finished. It is useful for some
# time-consuming operations. Like:
# > npm install | a
alias a="terminal-notifier -sound default"
# Just show the notification without context:
# > echo 'ss' && aa
alias aa="a -message Done"
alias trunc='truncate -s 0'
# Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usag
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
function __word_grep(){ word123456789="$1|$" && grep -E --color=auto $word123456789 $2 && unset word123456789 }
alias wgrep='__word_grep'
# Ruby & Rails
alias bx='bundle exec'
alias bxr='bundle exec rake'
alias bxc='bundle exec cap'
alias railss='RAILS_LOG_TO_STDOUT=1 bundle exec rails s'
alias railsc='bundle exec rails c'
alias bxrspec='bundle exec rspec'
alias railsbin='bundle exec rails app:update:bin && bundle binstubs bundler --force'
alias rails4bin='bundle exec rake rails:update:bin && bundle binstubs bundler --force'
function __cap(){ bundle exec cap $1 deploy; }
alias capd='__cap'
function __cap_patch(){ bundle exec cap $1 deploy:patch; }
alias cap_patch='__cap_patch'
function __cap_minor(){ bundle exec cap $1 deploy:minor; }
alias cap_minor='__cap_minor'
function __cap_major(){ bundle exec cap $1 deploy:major; }
alias cap_major='__cap_major'
function __cap_rollback() { bundle exec cap $1 deploy:rollback; }
alias cap_rollback='__cap_rollback'
function __puma_start(){ bundle exec cap $1 puma:start; }
alias puma_start='__puma_start'
function __puma_stop(){ bundle exec cap $1 puma:stop; }
alias puma_stop='__puma_stop'
function __puma_smartstop(){ bundle exec cap $1 puma:smart_stop; };
alias puma_smartstop='__puma_smartstop'
function __puma_restart(){ bundle exec cap $1 puma:stop && bundle exec cap $1 puma:start; };
alias puma_restart='__puma_restart'
funcion __aws_dynamo_local(){aws dynamodb $@ --endpoint-url http://localhost:8000}
alias aws_dynamo_local='__aws_dynamo_local'
alias lookbusy="cat /dev/urandom | hexdump -C | grep \"34 32\""
# View HTTP traffic
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\\: .*|GET \\/.*\""
function __nmap_ciphers(){ nmap -sV --script ssl-enum-ciphers -p $2 $1; };
alias nmap_ciphers="__nmap_ciphers"
alias ipl="dig +short myip.opendns.com @resolver1.opendns.com" # or ip="curl ipinfo.io/ip"
alias iplocate='function locate(){ curl https://www.iplocate.io/api/lookup/$1; echo; }; locate'
alias local_ip="hostname -I | awk '{print $1}'" # for mac local_ip="ipconfig getifaddr en0"
alias all_hosts_on_network="sudo nmap -sP $1"
function __find_in_pdf(){ find * -iname '*.pdf' -exec pdfgrep $1 {} +; }
alias find_in_pdf='__find_in_pdf'
function __wifi_pass(){ security find-generic-password -D "AirPort network password" -a $1 -g; }
alias wifi_password='__wifi_pass'
function __cheatsh(){ curl cht.sh/$1/$2; echo; }
alias cheat='__cheatsh'
alias instalg='sudo apt-get install -y'
alias instalb='brew install'
alias process='ps -aux'
alias disk='df -h'
# Docker
function __dockersh(){ docker exec -it $1 /bin/sh; }
alias dockersh='__dockersh'
function __dockerbash(){ docker exec -it $1 /bin/bash; }
alias dockerbash='__dockerbash'
function __dockerpasswd(){ docker exec -itu $2 $1 passwd; } # $2 user, $1 container name
alias dockerpasswd='__dockerpasswd'
# Lock the screen (when going AFK)
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# Recursively remove .DS_Store files
alias cleanupds="find . -type f -name '*.DS_Store' -ls -delete"