]> git.wh0rd.org - home.git/blame - .profile.d/aliases.sh
cros-board: update
[home.git] / .profile.d / aliases.sh
CommitLineData
1afdf944 1alias axine='xine -A null'
de7f2c38 2alias b='bzr'
5b61754d 3alias bc='bc -q'
1afdf944
MF
4#alias bittorrent-curses='bittorrent-curses --max_upload_rate 10'
5#alias bt='bittorrent-curses --max_upload_rate 10 --save_in . --save_incomplete_in .'
83b07a3a 6alias cdrecord='cdrecord -vvv -eject driveropts=burnfree'
5b61754d 7alias duh='du . --max-depth=1 -h'
63d15f58 8alias eclipse='eclipse-3.2 -vmargs -Xmx512m'
ca0cd585 9alias g='git'
5b61754d 10alias gdb='gdb --quiet'
1afdf944 11alias gdbtui='gdbtui --quiet'
8a844016 12alias nohist='export HISTFILE=/dev/null'
d85737d7 13alias kpdf='okular'
14031d68 14if command -v elinks >/dev/null ; then
78ddcb31
MF
15 alias links='elinks -default-mime-type text/html'
16 alias lynx=links
14031d68
MF
17elif command -v lynx >/dev/null ; then
18 alias lynx='lynx -nopause -accept_all_cookies -use_mouse'
19fi
5b61754d
MF
20alias minicom='minicom -w -c on'
21alias nslookup='nslookup -sil'
d80dd902
MF
22alias p1='patch -p1'
23alias p1d='patch -p1 --dry-run'
24alias p1dr='patch -p1 --dry-run -R'
25alias p1r='patch -p1 -R'
1afdf944 26alias quake4='quake4 +set s_driver oss'
aa909367 27alias rrsync='rsync -Hav --inplace --progress'
5b61754d 28alias s='aspell -a'
375dc529 29sss() { aspell -a <<<"$*"; }
e0284030
MF
30sdisp() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec "$0" "$@"' "$@" ; }
31smplayer() { sdisp mplayer "$@" ; }
32smpv() { sdisp mpv "$@" ; }
33svlc() { sdisp vlc "$@" ; }
34svnc() { sdisp x11vnc -q -nopw ; }
35sweb() { sdisp google-chrome-beta "$@" ; }
36sxdg() { sdisp xdg-open "$@" ; }
ef8e17a2 37alias trc=tremc
1afdf944 38alias xine='xine -l'
5b61754d 39
276cf0d7 40alias wol-vapier='wakeonlan -i 192.168.1.255 00:25:22:64:19:79; wakeonlan -i 192.168.0.255 00:25:22:64:19:79'
145ec29a 41
22072cde
MF
42_ipython() {
43 # These guys keep changing their CLI because they hate their users.
44 local cmd=$1; shift
45 local args=(
46 --no-banner
47 --no-confirm-exit
48 --pdb
49 --nosep
50 --term-title
51 --pprint
52 )
53
54 case $(command ${cmd} --version) in
55 0*) ;;
56 [123]*)
57 args+=(
58 --PromptManager.in_template='>>> '
59 --PromptManager.out_template=''
60 --PromptManager.justify=False
61 )
62 ;;
63 esac
64
65 command ${cmd} "${args[@]}" "$@"
66}
67ipython() { _ipython ${FUNCNAME}; }
68ipython2() { _ipython ${FUNCNAME}; }
69ipython3() { _ipython ${FUNCNAME}; }
70
019bffbb
MF
71adk_path() {
72 local adk=/usr/local/src/android/adk/current/sdk
73 PATH+=":${adk}/tools:${adk}/platform-tools"
74}
75
06ac7c77
MF
76pd() {
77 if [[ $# -eq 0 ]] ; then
78 popd
cf68f8b6
MF
79 elif [[ $# -eq 1 && $1 == "--" ]] ; then
80 dirs -v
06ac7c77
MF
81 else
82 pushd "$@"
83 fi
84}
85
cf68f8b6
MF
86cd_history() {
87 if [[ $# -eq 1 ]] ; then
88 case $1 in
89 -h)
90 command dirs "$1" |& tail -1
91 command cd "$1" |& tail -1
92 return
93 ;;
94 --help)
95 command dirs "$1"
96 command cd "$1"
97 return
98 ;;
99 -[clpv])
100 command dirs "$1"
101 return
102 ;;
103 -[0-9]*)
104 set -- "$(dirs "+${1:1}")"
105 ;;
106 esac
107 fi
d3a35d3c 108
cf68f8b6
MF
109 if command cd "$@" ; then
110 pushd -n "${PWD}" >/dev/null
d3a35d3c
MF
111 else
112 local ret=$?
113
114 if [[ $# -gt 1 ]] ; then
115 # The `cd` above should have shown an error message for us.
116 local arg first_arg="$1"
117 while [[ $# -gt 0 ]] ; do
118 arg="$1"
119 shift
120 if [[ -d ${arg} ]] ; then
121 if [[ $# -gt 0 ]] ; then
122 printf 'cd: remaining: %s\n' "$@" >&2
123 fi
124 printf 'cd: entering: %s\n' "${arg}" >&2
125 cd_history "${arg}"
126 return
127 else
128 printf 'cd: skipping: %s\n' "${arg}" >&2
0e8e59e6 129 fi
d3a35d3c
MF
130 done
131 # If we're still here, then we didn't cd anywhere.
132 echo "cd: cwd is unchanged!" >&2
133 fi
134
135 return ${ret}
cf68f8b6
MF
136 fi
137}
138alias cd='cd_history'
139
77ee95d3 140if [[ ${TERM} != "dumb" ]] ; then
aa909367 141 export GREP_COLORS=ne #470810
4c1fde46 142 alias grep='grep --colour=auto -d skip'
77ee95d3
MF
143 alias ls='ls --color=auto'
144fi
145
5b61754d 146scrub_patch() {
4c1fde46
MF
147 sed -i \
148 -e '/^index /d' \
5b61754d 149 -e '/^new file mode /d' \
4c1fde46 150 -e '/^Index:/d' \
5b61754d
MF
151 -e '/^=========/d' \
152 -e '/^RCS file:/d' \
153 -e '/^retrieving/d' \
154 -e '/^diff/d' \
155 -e '/^Files .* differ$/d' \
1c9edcf2 156 -e '/^Binary files .* differ$/d' \
5b61754d
MF
157 -e '/^Only in /d' \
158 -e '/^Common subdirectories/d' \
4c1fde46
MF
159 -e '/^deleted file mode [0-9]*$/d' \
160 -e '/^+++/s:\t.*::' \
161 -e '/^---/s:\t.*::' \
162 "$@"
5b61754d
MF
163}
164
1afdf944 165scrub_html() {
e0db24bd
MF
166 local a=(
167 'lt' '<'
168 'gt' '>'
169 'nbsp' ' '
170 'amp' '&'
171 'quot' '"'
172 )
173 [[ $# -gt 0 ]] && set -- "$@" -i
174 eval sed \"\$@\" $(printf -- ' -e "s|\&%s;|%q|g"' "${a[@]}")
5b61754d 175}