-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
356 lines (318 loc) · 9.67 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# NAVIGATION
##########################################
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias c='clear'
alias h='history'
alias ex='exit'
alias snippets='vim ~/.vim/snippets/'
alias vimrc='vim ~/.vimrc' # Open vimrc
alias vimplugins='vim ~/.vim-plugins' # Open vim-plugins
alias aliases='vim ~/.aliases' # Open aliases
alias latest='vim $(ls -t | head -1)' # Open latest file in directory
alias wd='watch -n .1 ls -lah' #watch current dir
alias cf="ls -l | wc -l" #count files in current dir
alias dotfiles='cd ~/dotfiles/'
alias size="ls -lhS | awk '{print \$5, \$9}'"
# Trash
##########################################
#alias tr='trash'
alias rt='restore-trash'
# mv, rm cp
##########################################
alias mv='mv -v'
alias rm='rm -i -v'
alias cp='cp -v'
# LS ALIASES
##########################################
if [[ is_osx ]]; then
alias l='ls -lFh'
alias ll='ls -alFh'
alias la='ls -lah'
else
alias l='ls -lFh --group-directories-first'
alias ll='ls -alFh --group-directories-first'
alias la='ls -lah --group-directories-first'
fi
alias sl='ls'
# GREP
##########################################
alias grep='grep --color=auto'
alias hg='history | grep'
alias gh='history | grep'
# SUDO (makes other aliases available to sudo)
##########################################
alias sudo='sudo '
alias doit='sudo $(history -p \!\!)'
# SOURCE FILES
##########################################
alias bashrc='source $HOME/.bashrc'
alias zshrc='source $HOME/.zshrc'
alias ssa='cdg && source site-aliases.sh'
# TMUX
##########################################
alias tmux='tmux -2' #Force tmux to assume the terminal supports 256 colours
alias ta='tmux attach -d'
alias tmux-reload='tmux source-file ~/.tmux.conf';
alias mon='tmuxp load site-monitor' # Site Monitor Layout
alias monk='tmux kill-session -t monitor' # Exit Site Monitor Layout
alias monx='monk'
# GIT
##########################################
alias current-branch='git rev-parse --abbrev-ref HEAD'
alias gb='git branch'
alias gbd='git branch -D'
alias gs='git status'
alias gpm='git push origin master'
alias gplm='git pull origin master'
alias gpb='git push origin $(current-branch)'
alias gplb='git pull origin $(current-branch)'
alias gpbf='git push -f origin $(current-branch)'
alias gma='git commit -am'
alias gm='git commit -m'
alias gc='git checkout'
alias gcm='git checkout master'
alias gcb='git checkout -b'
alias ga='git add -A .'
alias gca='git commit --amend'
alias grm='git rm $(git ls-files --deleted) '
alias ni='git commit -m "New Images"';
alias gl='git log --pretty=format:"%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]" --decorate --date=relative --graph'
alias gll='git log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate --numstat'
alias gls='git log --date=short --pretty=format:"%C(124)%ad %C(24)%h %C(34)%an %C(252)%s%C(178)%d"'
alias gitclean='git gc --prune=now --aggressive'
# Python
##########################################
alias python='python3'
alias py='python'
# Get to the top of a git tree
##########################################
cdg () {
TEMP_PWD=`pwd`
while ! [ -d .git ]; do
cd ..
done
OLDPWD=$TEMP_PWD
}
# Gets the scp path for a file
##########################################
scpget () {
{ echo $(getip); echo ":"; echo $(readlink -f $1); } | sed ':a;N;$!ba;s/\n//g'
}
alias getscp=scpget
# Set Dev Function
##########################################
function setdev() {
case "$1" in
'bc')
DESIGNATOR='bc'
SITE_NAME='BadCredit.org'
cd $BC_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'da')
DESIGNATOR='da'
SITE_NAME='DatingAdvice.com'
cd $DA_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'db')
DESIGNATOR='bd'
SITE_NAME='DigitalBrands.com'
cd $DB_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'dn')
DESIGNATOR='dn'
SITE_NAME='DatingNews.com'
cd $DN_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'cr')
DESIGNATOR='cr'
SITE_NAME='CardRates.com'
cd $CR_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'ha')
DESIGNATOR='ha'
SITE_NAME='HostingAdvice.com'
cd $HA_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'hr')
DESIGNATOR='hr'
SITE_NAME='HostingReport.com'
cd $HR_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'mt')
DESIGNATOR='mt'
SITE_NAME='MoneyTrends.com'
cd $MT_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'404')
DESIGNATOR='404'
SITE_NAME='404.center'
cd $FOF_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'dr')
DESIGNATOR='dr'
SITE_NAME='thedrizzle.org'
cd $DR_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
'sf')
DESIGNATOR='sf'
SITE_NAME='ScreamingFrog'
cd $SF_HOME_DIR
source site-aliases.sh
echo "Environment Set: $SITE_NAME"
;;
esac
}
alias sd=setdev
# VIM
##########################################
# Use Neovim if installed. Else use vim
##########################################
#getvim () {
#if hash nvim >/dev/null 2>&1; then
#nvim
#else
#vim
#fi
#}
#alias vim=getvim
# DOCKER
##########################################
alias dcu="docker-compose up"
alias dcd="docker-compose down"
alias dcb="docker-compose build"
alias dcr="docker-compose run"
alias dl="docker-compose logs -f" #Docker logs
alias dps="docker ps" #Docker process list
alias dsr="dstop && dremove" # Stop and remove all docker containers
dstop() { docker stop $(docker ps -aq); } #Stop all docker containers
dremove() { docker rm $(docker ps -a -q); } #Remove all docker containers
dcc(){ docker-compose exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" $1 bash } #Login into given Docker container
alias dockerclean='docker system prune --all --volumes --force && docker volume rm $(docker volume ls -q -f dangling=true)'
alias dri="docker rmi $(docker images -a -q)" # Remove cached images
# PROGRAMS
##########################################
alias monsoon='php ~/monsoon-php/monsoon.php'
alias ack="ack-grep"
alias bat="batcat"
alias serve="python -m SimpleHTTPServer"
# SERVICES
##########################################
alias update='sudo apt-get update && sudo apt-get upgrade -y && upgrade_oh_my_zsh && cd $HOME/dotfiles && gplm && cd - && zshrc'
alias ra='sudo service apache2 reload'
alias rv='sudo service varnish reload'
# SITES
##########################################
USER='pj'
BC='50.28.106.87'
CR='67.43.9.201'
DA='50.28.102.35'
DB='64.225.57.167'
DN='67.43.9.46'
DR='159.203.151.178'
GVS='142.93.10.78'
HA='69.167.152.76'
HR='50.28.103.17'
MT='159.89.44.119'
RM='64.91.241.174'
SF='142.93.113.123'
DR='159.203.151.178'
PJDEV='159.65.174.63'
PWBC='159.89.95.0'
PWHA='67.205.147.53'
PWDA='157.230.219.87'
alias pwbc="mosh $USER@$PWBC"
alias pwha="mosh $USER@$PWHA"
alias pwda="mosh $USER@$PWDA"
alias bc="mosh $USER@$BC"
alias cr="mosh $USER@$CR"
alias crp="mosh [email protected]"
alias da="mosh $USER@$DA"
alias db="mosh $USER@$DB"
alias dc="mosh $USER@$DC"
alias dn="mosh $USER@$DN"
alias dr="mosh $USER@$DR"
alias gvs="mosh $USER@$GVS"
alias ha="mosh $USER@$HA"
alias hr="mosh $USER@$HR"
alias mt="mosh $USER@$MT"
alias sf="mosh $USER@$SF"
alias 404="mosh [email protected]"
alias rainmaker="mosh $USER@$RM"
alias docs="mosh [email protected]"
alias dev="mosh [email protected]"
alias pjdev="mosh $USER@$PJDEV"
#alias careeners="ssh [email protected]"
alias careeners="ssh [email protected]"
# PERMISSIONS
##########################################
alias www-data='sudo chown -R www-data:www-data *';
#alias db-admin='sudo chown -R db-admin:db-admin *';
# BUILD
##########################################
alias buildsite="./build-site.sh"
alias buildassets="cd build && ./build-assets.sh && cd - > /dev/null"
alias buildhtml="cd build && ./build-html.sh && cd - > /dev/null"
alias bs="buildsite"
alias ba="buildassets"
alias bh="buildhtml"
# WORDPRESS
##########################################
alias w3tc="wp-cli plugin toggle w3-total-cache"
# VARNISH
##########################################
alias purge='curl -X PURGE $1';
# Cloudflare
##########################################
alias cf-tunnel="cloudflared tunnel --url http://localhost:3000"
# Home
##########################################
alias nas="ssh [email protected]"
#
# MISC
##########################################
alias less-upgrade='sudo npm install -g [email protected]'
alias less-downgrade='sudo npm install -g [email protected]'
alias tial="tail";
alias ctags-gen="ctags -R -f .git/tags ." #Generate ctags
alias weather='curl http://wttr.in/32601'; #Show current weather
alias getip="curl ifconfig.co" #Show IP Address
alias ipget='getip'
alias color="{spectrum_ls && spectrum_bls} | less" #All colors
alias color-fg="spectrum_ls | less" #Foregroud colors
alias color-bg="spectrum_bls | less" #Background colors
alias perm="stat --format '%a' $1" #Show file permision numbers
alias ubuntu="lsb_release -a" #Show Ubuntu version
alias lts="lsb_release -a" #Show Ubuntu version
alias network="sudo tcpdump -i en0" #Show network traffic
# SUFFIX ALIASES ( if extension: open with )
##########################################
alias -s log="tail -f"
alias -s php="vim"
alias -s css="vim"
alias -s less="vim"
alias -s js="vim"
alias -s md="vim"