]> git.wh0rd.org - home.git/blob - .profile.d/aliases.sh
add mpv settings
[home.git] / .profile.d / aliases.sh
1 alias axine='xine -A null'
2 alias b='bzr'
3 alias 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 .'
6 alias cdrecord='cdrecord -vvv -eject driveropts=burnfree'
7 alias duh='du . --max-depth=1 -h'
8 alias eclipse='eclipse-3.2 -vmargs -Xmx512m'
9 alias g='git'
10 alias gdb='gdb --quiet'
11 alias gdbtui='gdbtui --quiet'
12 alias nohist='export HISTFILE=/dev/null'
13 alias kpdf='okular'
14 if command -v elinks >/dev/null ; then
15 alias links='elinks -default-mime-type text/html'
16 alias lynx=links
17 elif command -v lynx >/dev/null ; then
18 alias lynx='lynx -nopause -accept_all_cookies -use_mouse'
19 fi
20 alias minicom='minicom -w -c on'
21 alias nslookup='nslookup -sil'
22 alias p1='patch -p1'
23 alias p1d='patch -p1 --dry-run'
24 alias p1dr='patch -p1 --dry-run -R'
25 alias p1r='patch -p1 -R'
26 alias quake4='quake4 +set s_driver oss'
27 alias rrsync='rsync -Hav --inplace --progress'
28 alias s='aspell -a'
29 sss() { aspell -a <<<"$*"; }
30 smplayer() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec mplayer "$@" >/dev/null 2>&1' sh "$@" ; }
31 smpv() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec mpv "$@"' sh "$@" ; }
32 svlc() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec vlc "$@" >/dev/null 2>&1' sh "$@" ; }
33 svnc() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec x11vnc -q -nopw' ; }
34 alias trc=transmission-remote-cli
35 alias xine='xine -l'
36
37 alias 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 }
64 ipython() { _ipython ${FUNCNAME}; }
65 ipython2() { _ipython ${FUNCNAME}; }
66 ipython3() { _ipython ${FUNCNAME}; }
67
68 adk_path() {
69 local adk=/usr/local/src/android/adk/current/sdk
70 PATH+=":${adk}/tools:${adk}/platform-tools"
71 }
72
73 pd() {
74 if [[ $# -eq 0 ]] ; then
75 popd
76 elif [[ $# -eq 1 && $1 == "--" ]] ; then
77 dirs -v
78 else
79 pushd "$@"
80 fi
81 }
82
83 cd_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 if command cd "$@" ; then
106 pushd -n "${PWD}" >/dev/null
107 elif [[ $# -gt 1 ]] ; then
108 # The `cd` above should have shown an error message for us.
109 local arg first_arg="$1"
110 while [[ $# -gt 0 ]] ; do
111 arg="$1"
112 shift
113 if [[ -d ${arg} ]] ; then
114 if [[ $# -gt 0 ]] ; then
115 printf 'cd: remaining: %s\n' "$@" >&2
116 fi
117 printf 'cd: entering: %s\n' "${arg}" >&2
118 cd_history "${arg}"
119 return
120 else
121 printf 'cd: skipping: %s\n' "${arg}" >&2
122 fi
123 done
124 # If we're still here, then we didn't cd anywhere.
125 echo "cd: cwd is unchanged!" >&2
126 fi
127 }
128 alias cd='cd_history'
129
130 if [[ ${TERM} != "dumb" ]] ; then
131 export GREP_COLORS=ne #470810
132 alias grep='grep --colour=auto -d skip'
133 alias ls='ls --color=auto'
134 fi
135
136 scrub_patch() {
137 sed -i \
138 -e '/^index /d' \
139 -e '/^new file mode /d' \
140 -e '/^Index:/d' \
141 -e '/^=========/d' \
142 -e '/^RCS file:/d' \
143 -e '/^retrieving/d' \
144 -e '/^diff/d' \
145 -e '/^Files .* differ$/d' \
146 -e '/^Binary files .* differ$/d' \
147 -e '/^Only in /d' \
148 -e '/^Common subdirectories/d' \
149 -e '/^deleted file mode [0-9]*$/d' \
150 -e '/^+++/s:\t.*::' \
151 -e '/^---/s:\t.*::' \
152 "$@"
153 }
154
155 scrub_html() {
156 local a=(
157 'lt' '<'
158 'gt' '>'
159 'nbsp' ' '
160 'amp' '&'
161 'quot' '"'
162 )
163 [[ $# -gt 0 ]] && set -- "$@" -i
164 eval sed \"\$@\" $(printf -- ' -e "s|\&%s;|%q|g"' "${a[@]}")
165 }