-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.aliases
More file actions
173 lines (129 loc) · 5.88 KB
/
.aliases
File metadata and controls
173 lines (129 loc) · 5.88 KB
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
#!/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'
if command -v spark >/dev/null 2>&1 && command -v lolcat >/dev/null 2>&1; then
alias clear='clear; echo; echo; seq 1 $(tput cols) | sort -R | spark | lolcat; echo; echo'
fi
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 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 h(){ howdoi "$@" -c -n 5; }
function makecpp(){ g++ "$1" -o "$2"; }
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'
alias duplicates2='echo "Start finding duplicates" && fdupes -r .'
# 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 usage
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
function wgrep(){ local word123456789="$1|$"; grep -E --color=auto "$word123456789" "$2"; }
# 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 capd(){ bundle exec cap "$1" deploy; }
function cap_patch(){ bundle exec cap "$1" deploy:patch; }
function cap_minor(){ bundle exec cap "$1" deploy:minor; }
function cap_major(){ bundle exec cap "$1" deploy:major; }
function cap_rollback(){ bundle exec cap "$1" deploy:rollback; }
function puma_start(){ bundle exec cap "$1" puma:start; }
function puma_stop(){ bundle exec cap "$1" puma:stop; }
function puma_smartstop(){ bundle exec cap "$1" puma:smart_stop; }
function puma_restart(){ bundle exec cap "$1" puma:stop && bundle exec cap "$1" puma:start; }
function aws_dynamo_local(){ aws dynamodb "$@" --endpoint-url http://localhost:8000; }
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 ipl="dig +short myip.opendns.com @resolver1.opendns.com" # or ip="curl ipinfo.io/ip"
function iplocate(){ curl "https://www.iplocate.io/api/lookup/$1"; echo; }
alias local_ip="hostname -I | awk '{print $1}'" # for mac local_ip="ipconfig getifaddr en0"
function all_hosts_on_network(){ sudo nmap -sP "$1"; }
function find_in_pdf(){ pdfgrep -rin --color=auto "$@" .; }
function wifi_password(){ security find-generic-password -D "AirPort network password" -a "$1" -g; }
function cheat(){ curl "cht.sh/$1/$2"; echo; }
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; }
function dockerbash(){ docker exec -it "$1" /bin/bash; }
function dockerpasswd(){ docker exec -itu "$2" "$1" passwd; } # $2 user, $1 container name
function curljq(){ curl -sS --fail "$@" | jq; }
# 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"
alias cleanup_node_modules="npx npkill"