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