]> git.wh0rd.org - home.git/blame - .profile.d/aliases.sh
import vapier-m
[home.git] / .profile.d / aliases.sh
CommitLineData
5b61754d
MF
1[[ $- != *i* ]] && return
2
3alias bc='bc -q'
4alias duh='du . --max-depth=1 -h'
5alias eclipse='eclipse-3.1 -vmargs -Xmx512m'
6alias gdb='gdb --quiet'
7alias grep='grep --colour=auto'
8alias ls='ls --color=auto'
9alias lynx='lynx -nopause -accept_all_cookies -use_mouse'
10alias minicom='minicom -w -c on'
11alias nslookup='nslookup -sil'
12alias s='aspell -a'
13ss() { aspell -a <<<"$*"; }
14
15grep-svn() { find '(' -wholename '*/.svn' -prune -o -type f -print0 ')' | xargs -0 grep "$@" ; }
16
17scrub_patch() {
18 sed -i \
19 -e '/^index /d' \
20 -e '/^new file mode /d' \
21 -e '/^Index:/d' \
22 -e '/^=========/d' \
23 -e '/^RCS file:/d' \
24 -e '/^retrieving/d' \
25 -e '/^diff/d' \
26 -e '/^Files .* differ$/d' \
27 -e '/^Only in /d' \
28 -e '/^Common subdirectories/d' \
29 -e '/^+++/s:\t.*::' \
30 -e '/^---/s:\t.*::' \
31 "$@"
32}
33
34cvs_gentoo_url() {
35_cvs_gentoo_url() {
36 if [[ -n $2 ]] ; then
37 echo "Usage: cvs_gentoo_url <file>[:rev1[:rev2]]"
38 return 1
39 fi
40
41 # spec has the form file:rev1[:rev2]
42 # rev2 defaults to rev1-1
43 export IFS=:
44 set -- $1
45 unset IFS
46
47 local file=$1
48 if [[ ! -e ${file} ]] ; then
49 echo "file '${file}' does not exist"
50 return 1
51 fi
52 local dir="."
53 [[ ${file} == */* ]] && dir=${file%/*}
54 file=${file##*/}
55
56 local rev2=$2
57 if [[ -z ${rev2} ]] ; then
58 rev2=$(
59 cd ${dir}
60 export IFS=/
61 set -- $(grep /${file}/ CVS/Entries)
62 unset IFS
63 echo $3
64 )
65 if [[ ${rev2} == "0" ]] ; then
66 # new file
67 rev2="1.1"
68 else
69 # existing file, bump rev automatically
70 rev2="1.$((${rev2#1.}+1))"
71 fi
72 fi
73 local rev2r=${rev2#1.}
74 local rev1=${3:-1.$((rev2r - 1))}
75
76 local cvsroot=$(<${dir}/CVS/Repository)
77 if [[ ${cvsroot} == gentoo-x86* ]] ; then
78 cvsroot=${cvsroot#gentoo-x86}
79 cvsroot=${cvsroot#/}
80 fi
81
82 local urirev
83 [[ ${rev2} == "1.1" || ${rev1} == "${rev2}" ]] \
84 && urirev="?rev=${rev2}" \
85 || urirev="?r1=${rev1}&r2=${rev2}"
86 echo "http://sources.gentoo.org/${cvsroot}/${file}${urirev}"
87}
88 local f
89 for f in "$@" ; do
90 _cvs_gentoo_url "${f}"
91 done
92 unset _cvs_gentoo_url
93}