-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzsh_aliases
158 lines (123 loc) · 3.9 KB
/
zsh_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
# Reload Bash.
alias rr='exec zsh'
# Edit zshrc in VSCode.
alias alz='subl ~/.zshrc'
alias al='subl ~/.zsh_aliases'
# Navigate to the previous directory.
alias -- -='cd -'
alias ..='cd ..'
# Various shortcuts.
alias dl='cd ~/Downloads'
alias dt='cd ~/Desktop'
alias wk='cd ~/Work'
alias si='cd ~/Sites'
#
# Editors
#
# VSCode.
alias c='code'
# PS aliases.
alias psa='ps aux'
alias psg='ps aux | grep -i'
#
# Services
#
rsmysql='sudo systemctl restart mysqld.service'
# Human readable DF & DU.
alias df='df -h'
alias du='du -h -d 2'
# Clear & list directory.
alias cls='clear; ls'
alias clr='clear'
# LS & grep.
alias lsg='ll | grep -i'
alias lla='ls -lah'
# Make cp & mv to be verbose.
alias cp='cp -v'
alias mv='mv -v'
# Prettyping
alias ping=prettyping
#
# Updates
#
alias update_os='sudo dnf upgrade --refresh'
alias update_npm='npmgu'
alias update_prezto='cd ~/.zprezto && git pull && git submodule update --init --recursive && cd -'
alias update_all='update_os; update_npm; update_prezto'
# Npm global updates
function npmgu() {
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f4)
do
npm -g --force install "$package"
done
}
#
# Internet
#
# Get external IP.
alias ip='dig +short myip.opendns.com @resolver1.opendns.com'
# Flush Directory Service cache.
alias flush='dscacheutil -flushcache && killall -HUP mDNSResponder'
# Dig.
alias dig='dig +nocmd any +multiline +noall +answer'
# Edit the hosts file.
alias hosts='sudo $EDITOR /etc/hosts'
#
# Dev
#
# URL encode.
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# Delete local branches which have already been merged into the current HEAD.
alias gitcleanup='git branch --merged | grep -v "\*" | xargs -n 1 git branch -d'
#
# Git
#
alias gpl='git pull --prune'
alias gs='git status'
# Time
alias week='date +%V'
alias clock='date +%T'
#
# Laravel
#
artisan() {
if [ -f bin/artisan ]; then
php bin/artisan "$@"
else
php artisan "$@"
fi
}
alias art='php artisan'
alias serve='artisan serve'
alias tinker='artisan tinker'
alias migrate='php artisan migrate'
# Misc PHP
t() {
if [ -f vendor/bin/phpunit ]; then
vendor/bin/phpunit "$@"
else
phpunit "$@"
fi
}
#
# GIF stuff *_*
# Copy a gif url in my clipboard
# Just in case I need a gif asap.
#
# Emulate the awesome Mac OS pbcopy function for Linux distrib
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias fine='echo -n "https://media.giphy.com/media/z9AUvhAEiXOqA/giphy.gif" | pbcopy; echo "Fine gif copied to clipboard"'
alias nope='echo -n "https://media.giphy.com/media/6h4z4b3v6XWxO/giphy.gif" | pbcopy; echo "Nope gif copied to clipboard"'
alias wtf='echo -n "https://media.giphy.com/media/26xBG9lQdU5YTRnJS/giphy.gif" | pbcopy; echo "WTF gif copied to clipboard"'
alias facepalm='echo -n "https://media.giphy.com/media/XsUtdIeJ0MWMo/giphy.gif" | pbcopy; echo "Facepalm gif copied to clipboard"'
alias thumbsup='echo -n "https://media.giphy.com/media/l2YWCz0kmmgdx8feM/giphy.gif" | pbcopy; echo "ThumbsUp gif copied to clipboard"'
alias godno='echo -n "https://media.giphy.com/media/12XMGIWtrHBl5e/giphy.gif" | pbcopy; echo "GODNO gif copied to clipboard"'
alias what='echo -n "https://media.giphy.com/media/fpXxIjftmkk9y/giphy.gif" | pbcopy; echo "WHAT gif copied to clipboard"'
alias please='echo -n "https://media.giphy.com/media/3h2lUwrZKilQKbAK6f/giphy.gif" | pbcopy; echo "PLS gif copied to clipboard"'
alias eheheh='echo -n "https://media.giphy.com/media/9MFsKQ8A6HCN2/giphy.gif" | pbcopy; echo "EHEHEH gif copied to clipboard"'
alias look='echo -n "https://giphy.com/gifs/funny-reaction-cute-E6gUCRWYFqDO8" | pbcopy; echo "LOOK gif copied to clipboard"'
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy; echo 'Shrug copied to clipboard'";
alias fight="echo '(ง'̀-'́)ง' | pbcopy; echo 'Fight copied to clipboard'";
# Clean the clipboard
alias gclean='pbcopy </dev/null; echo "Clipboard cleaned."'