-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_alias
106 lines (87 loc) · 2.79 KB
/
_alias
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
#############################################################
# -- general settings
#
if [[ `uname -s` != "Darwin" ]]
then
alias la='ls -la --color'
alias ll='ls -lF --color'
alias ls='ls $LS_OPTIONS --color'
else
alias la='ls -laG'
alias ll='ls -lFG'
alias ls='ls -G $LS_OPTIONS'
fi
alias v='vim'
alias vi='vim'
alias gv='gvim'
alias vd='vimdiff'
alias vt='vim -t'
alias md='mkdir -p'
alias rd='rmdir'
alias psg='ps auxw |grep -i'
alias cd-='cd -'
alias cdf='cd *$1*/'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
alias rm='rm -iv'
alias mv='mv -iv'
alias cp='cp -iv'
alias ln='ln -iv'
alias eject='eject -v'
alias df='df -hT'
alias du='du -h'
alias info='info --vi-keys'
alias free='free -tm'
alias ipython='/opt/homebrew/Cellar/ipython/7.26.0/bin/ipython'
alias su='su -'
alias fn='find . -name'
alias fg='find . -type f -print0 | xargs -0 -e egrep -n --color=auto'
#alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
alias webshare='$(which python) -m SimpleHTTPServer ${1:-8000}'
alias tmux="tmux -2"
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
#############################################################
# -- fasd settings
#
alias sv="fasd -e $EDITOR -si"
#alias a='fasd -a' # any
#alias s='fasd -si' # show / search / select
#alias d='fasd -d' # directory
#alias f='fasd -f' # file
#alias sd='fasd -sid' # interactive directory selection
#alias sf='fasd -sif' # interactive file selection
#alias z='fasd_cd -d' # cd, same functionality as j in autojump
#alias zz='fasd_cd -d -i' # cd with interactive selection
#############################################################
# -- other settings
alias beep='echo -en "\007"'
alias rehash='hash -r'
alias unmount='echo "Error: Try the command: umount" 1>&2; false'
alias you='if test "$EUID" = 0 ; then /sbin/yast2 online_update ; else su - -c "/sbin/yast2 online_update" ; fi'
# 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$//'\'')"'
alias clean_pycs='find . -name "*.pyc" -exec rm {} \;'
#############################################################
# -- functions
whatsmy_primary_ip() {
local _if="$(netstat -nr | grep ^0\.0\.0\.0 | awk '{print $8}')"
local _ip="$(/sbin/ifconfig $_if | \
grep '^[[:space:]]*inet ' | awk '{print $2}' | \
awk -F':' '{print $2}')"
if [ -z "$_ip" -o "$_ip" == "" ]; then
echo "Could not determine primary IP address"
return 10
else
echo $_ip
fi
}
whatsmy_public_ip() {
#curl --silent 'http://jsonip.com/'
curl ifconfig.me
}