-
Notifications
You must be signed in to change notification settings - Fork 1
/
common_aliases
executable file
·87 lines (70 loc) · 2.54 KB
/
common_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
# ls aliases
# OSX: to make this work, install gnu versions and set path correctly
alias ls="ls -F --color=auto --group-directories-first"
# grep aliases
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
# misc
alias vi="vim"
# clear entire buffer
alias cls='printf "\033c"'
alias pdb='python -m pdb'
# uri decode and encode thanks to slm (http://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding)
alias urldecode='python -c "import sys, urllib as ul; \
print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; \
print ul.quote_plus(sys.argv[1])"'
# nano 4 spaces for each tab thanks to stefano (http://askubuntu.com/questions/40732/how-do-i-get-spaces-instead-of-tabs-in-nano)
alias nano="nano -ET4"
## start windows
# ifconfig for ipconfig
#alias ifconfig="ipconfig"
# windows kill task using PID
#alias wkill="taskkill /F /PID"
# windows kill task using process name
#function wkillall {
# tasklist | grep $1 | awk '{print $2;}' | while read f; do wkill $f; done;
#}
# windows ip
#alias winip="ipconfig | grep Wireless -A5 | grep IPv4 | awk '{print \$NF}'"
## end windows
# alias todo
alias t="todo.sh"
# remove all compiled pyc files recursively from pwd
# alias rmpyc='find . -name "*.pyc" 2>&1 | while read f; do rm $f; done'
alias rmpyc='find . -name "*.pyc" -delete'
# bring it up without provision, save it to init, and provision
alias vunp='vagrant up --no-provision; vagrant halt; vagrant snapshot save init; vagrant up --provision; vagrant ssh'
# vagrant restore to init and provision
alias vrap='vagrant snapshot restore init; vagrant up --provision; vagrant ssh'
# less cannot unzip gzip files
# source: https://askubuntu.com/a/62660
# [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# https://superuser.com/a/417152
#export GREP_OPTIONS='--color=always'
export GREP_COLOR='1;35;40'
# https://stackoverflow.com/a/10768196
dec2ip () {
local ip dec=$@
for e in {3..0}
do
((octet = dec / (256 ** e) ))
((dec -= octet * 256 ** e))
ip+=$delim$octet
delim=.
done
printf '%s\n' "$ip"
}
ip2dec () {
local a b c d ip=$@
IFS=. read -r a b c d <<< "$ip"
printf '%d\n' "$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d))"
}
genguid() {
echo $(python -c "import uuid; print str(uuid.uuid4()).replace('-', '')")
}
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
# add completion for itermocil
compctl -g '~/.itermocil/*(:t:r)' itermocil
alias jq='jq -C'