Mercurial > hg > config
annotate .bashrc @ 300:a1c72313b3df
minor mods
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 11 May 2013 17:55:17 -0700 |
parents | ee3c1b65d6d1 |
children | 266d6b337373 |
rev | line source |
---|---|
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
1 source /etc/profile |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
2 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
3 # Test for an interactive shell. There is no need to set anything |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
4 # past this point for scp and rcp, and it's important to refrain from |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
5 # outputting anything in those cases. |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
6 if [[ $- != *i* ]] ; then |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
7 # Shell is non-interactive. Be done now! |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
8 return |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
9 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
10 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
11 # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
12 if [[ -f ~/.dir_colors ]] ; then |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
13 eval $(dircolors -b ~/.dir_colors) |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
14 elif [[ -f /etc/DIR_COLORS ]] ; then |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
15 eval $(dircolors -b /etc/DIR_COLORS) |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
16 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
17 |
67
a791d862148c
add a default MOZCONFIG variable -- BE CAREFUL!
Jeff Hammel <jhammel@mozilla.com>
parents:
66
diff
changeset
|
18 # variables |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
19 export BROWSER=$(which firefox) |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
20 export CLICOLOR=1 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
21 export EDITOR='emacs -nw' |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
22 export JS_EDITLINE=1 |
171
0110a435d2ce
use a directory for mozconfigs
Jeff Hammel <jhammel@mozilla.com>
parents:
169
diff
changeset
|
23 export MOZCONFIG=~/mozilla/mozconfigs/mozconfig |
88
24f933c9d97f
add an xpcshell alias, silly ubuntu installed version is fuxored
Jeff Hammel <jhammel@mozilla.com>
parents:
86
diff
changeset
|
24 export MOZSOURCE=~/mozilla/src/mozilla-central |
24f933c9d97f
add an xpcshell alias, silly ubuntu installed version is fuxored
Jeff Hammel <jhammel@mozilla.com>
parents:
86
diff
changeset
|
25 export MOZOBJ=~/mozilla/src/obj-browser |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
26 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
27 # aliases |
250 | 28 alias awd="python -c 'import os; print os.path.realpath(\".\")'" |
246
d9b8d176c449
add a thing to get the full path to current patch and start organizing aliases
Jeff Hammel <jhammel@mozilla.com>
parents:
241
diff
changeset
|
29 alias currentpatch='echo `hg root`/.hg/patches/`hg qapp -v | head -n 1 | cut -f 3 -d " "`' |
d9b8d176c449
add a thing to get the full path to current patch and start organizing aliases
Jeff Hammel <jhammel@mozilla.com>
parents:
241
diff
changeset
|
30 alias datestamp='date +%Y%m%d%H%M%S' |
250 | 31 alias distribute='python setup.py egg_info -RDb "" sdist register upload' |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
32 alias grep='grep --colour=auto' |
246
d9b8d176c449
add a thing to get the full path to current patch and start organizing aliases
Jeff Hammel <jhammel@mozilla.com>
parents:
241
diff
changeset
|
33 alias ls='ls --color=auto' |
250 | 34 alias random="python -c 'import sys, random; foo = sys.argv[1:]; random.shuffle(foo); print \" \".join(foo)'" |
35 alias wget='wget --no-check-certificate' | |
88
24f933c9d97f
add an xpcshell alias, silly ubuntu installed version is fuxored
Jeff Hammel <jhammel@mozilla.com>
parents:
86
diff
changeset
|
36 alias xpcshell="LD_LIBRARY_PATH=${MOZOBJ}/dist/bin ${MOZOBJ}/dist/bin/xpcshell" |
241 | 37 |
38 # bzconsole aliases for filing bugs | |
39 alias mozbase-bug="bz new Mozbase --cc ':wlach'" | |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
40 alias mozbuild-bug="bz new --product Core 'Build Config' --cc ':gps'" |
215
bf4eb11045cc
front end for mozharness bugs
Jeff Hammel <jhammel@mozilla.com>
parents:
171
diff
changeset
|
41 alias mozharness-bug="bz new 'Release Engineering: Automation (General)' --cc ':aki' --whiteboard 'mozharness'" |
241 | 42 alias releng-bug="bz new 'Release Engineering: Automation (General)'" |
217 | 43 alias talos-bug="bz new Talos --cc ':jmaher' --cc ':BYK'" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
44 |
66 | 45 # PROMPT |
119 | 46 PS1='│' |
47 PS2='.' | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
48 PROMPT_COMMAND='echo -ne "\033]0;${SSH_CLIENT/*/$HOSTNAME:}${PWD/~/~}\007"' |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
49 |
66 | 50 # PATHs |
147
700b43d5052e
workaround firefox link problems....:(
Jeff Hammel <jhammel@mozilla.com>
parents:
144
diff
changeset
|
51 export PATH=~/firefox:~/bin:~/python:$PATH:/usr/sbin:/usr/games/bin |
169
ab2fc6222f94
add virtualenv to the PYTHONPATH
Jeff Hammel <jhammel@mozilla.com>
parents:
167
diff
changeset
|
52 export PYTHONPATH=~/python:$PYTHONPATH:~/virtualenv |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
53 |
84 | 54 ### functions |
55 | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
56 cdwin() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
57 # change directory to a window's location using its title |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
58 DIR=$(xwininfo | dictify.py xwininfo | awk '{ print $NF }' | sed 's/"//g') |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
59 DIR=${DIR/\~/$HOME} |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
60 cd $DIR |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
61 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
62 |
66 | 63 function colors() { |
64 | |
65 CLR_WHITE="\033[0;37m" | |
66 CLR_WHITEBOLD="\033[1;37m" | |
67 CLR_BLACK="\033[0;30m" | |
68 CLR_GRAY="\033[1;30m" | |
69 CLR_BLUE="\033[1;34m" | |
70 CLR_BLUEBOLD="\033[0;34m" | |
71 CLR_GREEN="\033[0;32m" | |
72 CLR_GREENBOLD="\033[1;32m" | |
73 CLR_CYAN="\033[0;36m" | |
74 CLR_CYANBOLD="\033[1;36m" | |
75 CLR_RED="\033[0;31m" | |
76 CLR_REDBOLD="\033[1;31m" | |
77 CLR_PURPLE="\033[0;35m" | |
78 CLR_PURPLEBOLD="\033[1;35m" | |
79 CLR_YELLOW="\033[0;33m" | |
80 CLR_YELLOWBOLD="\033[1;33m" | |
81 CLR_NOTHING="\033[0m" | |
82 } | |
83 colors | |
84 | |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
85 eend() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
86 # edit the end of a file with emacs |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
87 FILE=$1 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
88 shift |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
89 emacs +`wc -l "$FILE"` $@ |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
90 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
91 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
92 git-diff-master() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
93 # differences of a git repository with master |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
94 git diff $(git merge-base HEAD master) |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
95 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
96 |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
97 # nice fast find function |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
98 EXCLUDES="(\.svn)|(\.mo$)|(\.po$)|(\.pyc$)" |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
99 ff() { |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
100 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
101 if (( $# < 2 )) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
102 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
103 FILENAME='*' # default -- look in all files |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
104 else |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
105 FILENAME=$2 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
106 fi |
76 | 107 CMD='command find -L $PWD -iname "${FILENAME}" -print0 2> /dev/null | xargs -r0 grep -il "$1" 2> /dev/null | egrep -v "${EXCLUDES}" 2> /dev/null' |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
108 # echo $CMD |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
109 eval $CMD |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
110 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
111 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
112 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
113 chainff() { |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
114 if (( $# < 2 )) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
115 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
116 return 0 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
117 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
118 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
119 RESULTS=`ff "$2" "$1"` |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
120 shift 2 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
121 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
122 for i in $RESULTS |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
123 do |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
124 for arg in $@ |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
125 do |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
126 if grep -il "$arg" "$i" &> /dev/null |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
127 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
128 touch /dev/null |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
129 else |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
130 i="" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
131 break |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
132 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
133 done |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
134 if [ -n "$i" ] |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
135 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
136 echo $i |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
137 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
138 done |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
139 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
140 |
66 | 141 # contextual fastfind |
142 cff () { | |
143 | |
144 if (( $# < 2 )); then | |
145 local FILENAME='*' # default -- look in all files | |
146 else | |
147 local FILENAME=$2 | |
148 fi | |
149 | |
150 for i in `ff "$1" "$FILENAME"`; do | |
151 echo -e "$CLR_GREEN--->>> ""$CLR_YELLOWBOLD""$i""$CLR_NOTHING" : | |
152 grep --color=auto -i -n -C 3 "$1" $i | |
153 done | |
154 | |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
155 } |
66 | 156 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
157 # make a temporary file if `tempfile` not available |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
158 tmpfile() { |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
159 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
160 if [ "$#" == "0" ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
161 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
162 args="tmp" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
163 else |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
164 args=$@ |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
165 fi |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
166 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
167 for i in $args |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
168 do |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
169 NEWNAME=${i}.$RANDOM |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
170 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
171 while [ -e $NEWNAME ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
172 do |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
173 NEWNAME=${NEWNAME}.tmp |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
174 done |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
175 echo "$NEWNAME" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
176 done |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
177 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
178 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
179 edpe() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
180 # edit and pipe the buffer to stdout |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
181 FILE=`tmpfile` |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
182 $EDITOR $FILE |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
183 cat $FILE |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
184 rm $FILE |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
185 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
186 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
187 isrunning() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
188 # is a process running? (by name) |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
189 # see also: talos for a better version |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
190 for i in "$@" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
191 do |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
192 ps axwww | grep "$i" | grep -v 'grep' |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
193 done | sort | uniq |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
194 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
195 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
196 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
197 killbyname() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
198 # kill a process by name |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
199 kill `isrunning "$@" | awk '{ print $1 }' | onelineit.py` |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
200 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
201 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
202 fn() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
203 # full name |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
204 python -c "import os; print os.path.realpath('$*')" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
205 } |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
206 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
207 pyfile() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
208 # python file name |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
209 python -c "import $1; print $1.__file__" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
210 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
211 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
212 swap() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
213 # swap two files |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
214 if [ "$#" != "2" ] |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
215 then |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
216 echo "Usage: $FUNCNAME <file1> <file2>" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
217 return |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
218 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
219 for i in "$1" "$2" |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
220 do |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
221 if [ ! -w "$i" ] |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
222 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
223 echo "$FUNCNAME: Can't move $i" |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
224 return 1 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
225 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
226 done |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
227 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
228 NEWNAME=`basename $1`.$RANDOM |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
229 while [ -e $NEWNAME ] |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
230 do |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
231 NEWNAME=${NEWNAME}.tmp |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
232 echo "$NEWNAME" |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
233 done |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
234 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
235 mv "$1" "$NEWNAME" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
236 mv "$2" "$1" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
237 mv "$NEWNAME" "$2" |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
238 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
239 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
240 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
241 whview() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
242 # which view |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
243 less `which $@` |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
244 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
245 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
246 whemacs() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
247 # which emacs |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
248 emacs -nw `which $@` |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
249 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
250 |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
251 ### functions for python |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
252 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
253 setup-all() { |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
254 # setup all for development |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
255 # TODO: flowerbed? |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
256 for i in * |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
257 do |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
258 if [ -e "${i}/setup.py" ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
259 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
260 cd "${i}" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
261 python setup.py develop |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
262 cd .. |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
263 fi |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
264 done |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
265 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
266 |
296 | 267 recreate-venv() { |
268 # recreate a virtualenv | |
269 VIRTUALENV="virtualenv.py" | |
270 for i in $@ | |
271 do | |
272 ${VIRTUALENV} --clear "${i}" | |
273 | |
274 SRCDIR="${i}"/src | |
275 if [ -d "${SRCDIR}" ] | |
276 then | |
277 . "${i}/bin/activate" | |
278 OLDPWD=${PWD} | |
279 cd "${SRCDIR}" | |
280 for j in * | |
281 do | |
282 if [ -e "${j}"/setup.py ] | |
283 then | |
284 cd "${j}" | |
285 python setup.py develop | |
286 cd .. | |
287 fi | |
288 done | |
289 cd "${OLDPWD}" | |
290 fi | |
291 done | |
292 } | |
293 | |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
294 ### functions for version control systems |
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
295 |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
296 svndance(){ |
71
3d111401010f
add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents:
67
diff
changeset
|
297 # do the svn import dance! |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
298 if (( $# )) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
299 then |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
300 svn import $1 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
301 cd .. |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
302 rm -rf $OLDPWD |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
303 svn co $1 $OLDPWD |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
304 cd $OLDPWD |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
305 else |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
306 return 1 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
307 fi |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
308 } |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
309 |
71
3d111401010f
add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents:
67
diff
changeset
|
310 difffiles() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
311 grep '^+++ ' $@ | sed 's/+++ b\///' |
71
3d111401010f
add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents:
67
diff
changeset
|
312 } |
3d111401010f
add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents:
67
diff
changeset
|
313 |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
314 hg-update-all() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
315 # update all hg repositories in the current directory |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
316 for i in *; |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
317 do |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
318 if [ -e $i/.hg ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
319 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
320 cd $i |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
321 hg pull |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
322 hg update |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
323 cd - |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
324 fi |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
325 done |
84 | 326 } |
327 | |
110
bf567a0e8fef
add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents:
103
diff
changeset
|
328 hg-qcommit() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
329 message=$1 |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
330 hg qrefresh |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
331 if [ -z "${message}" ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
332 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
333 hg qcommit |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
334 else |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
335 hg qcommit -m "${message}" |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
336 fi |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
337 hgroot=$(hg root) |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
338 patches=${hgroot}/.hg/patches/ |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
339 if [ -e ${patches}.hg ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
340 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
341 cd ${patches} |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
342 hg push |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
343 fi |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
344 cd - |
110
bf567a0e8fef
add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents:
103
diff
changeset
|
345 } |
bf567a0e8fef
add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents:
103
diff
changeset
|
346 |
89
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
347 hgrc() { |
274 | 348 # write an hgrc file |
349 # TODO: in the case you're in an `hg root`...what then? | |
350 # - NOTE: /home/jhammel is an `hg root`, so be careful! | |
351 # There should be a way to update $(hg root)/.hg/hgrc automatically | |
352 # Likewise, git | |
353 # Python script? .dotfile? | |
89
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
354 ROOT="${1}" |
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
355 echo "[paths]" |
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
356 echo "default = ${ROOT}" |
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
357 echo "default-push = ssh://${ROOT#http*://}" |
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
358 } |
dfda4f7d4db4
add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents:
88
diff
changeset
|
359 |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
360 ### functions for web content |
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
361 |
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
362 blog-file() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
363 echo "$HOME/web/blog/k0s/entries/public/$1" |
260
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
364 } |
eacc4c5ed628
add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents:
250
diff
changeset
|
365 |
101 | 366 flatten() { |
367 directory=$PWD | |
368 if [ "$#" == "1" ] | |
369 then | |
370 directory=$1 | |
371 fi | |
372 cd $directory | |
373 unset find # don't use the alias | |
102 | 374 find . -name '*' -type f | sed 's/.\///' | while read line |
101 | 375 do |
376 filename=$(echo $line | sed 's/\//-/g') | |
377 mv "${line}" "${filename}" | |
378 done | |
379 for i in * | |
380 do | |
381 if [ -d $i ] | |
382 then | |
383 rm -rf "${i}" | |
384 fi | |
385 done | |
386 } | |
387 | |
103
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
388 filehandles() { |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
389 TMPFILE=$(tmpfile) |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
390 ps -e|grep -v TTY|awk {'print "echo -n \"Process: "$4"\tPID: "$1"\tNumber of FH: \"; lsof -p "$1"|wc -l"'} > ${TMPFILE} |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
391 . ${TMPFILE} | sort |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
392 rm ${TMPFILE} |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
393 } |
e841c419199e
add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents:
102
diff
changeset
|
394 |
167
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
395 quotemail() { |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
396 |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
397 command='s/^/> /' |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
398 inplace="" |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
399 if [ "$#" == "2" ] |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
400 then |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
401 inplace="-i" |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
402 fi |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
403 |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
404 sed ${inplace} "${command}" "$1" |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
405 |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
406 } |
842e1fca024a
add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents:
147
diff
changeset
|
407 |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
408 ### include overrides for commands |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
409 source ~/.bash_overrides |
47
a0636527f809
regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
410 |
a0636527f809
regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
411 ### regenerate fluxbox menus here for convenience |
a0636527f809
regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
412 MENU=~/web/site/programs.html |
237
b33d0c78132c
move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents:
224
diff
changeset
|
413 regeneratefluxmenu() { |
295
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
414 if [ -e $MENU ] |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
415 then |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
416 # XXX could be safer |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
417 html2flux.py $MENU > ~/.fluxbox/applications |
e2564dd51334
slowly slowly, step by step...
Jeff Hammel <jhammel@mozilla.com>
parents:
279
diff
changeset
|
418 fi |
237
b33d0c78132c
move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents:
224
diff
changeset
|
419 } |
b33d0c78132c
move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents:
224
diff
changeset
|
420 regeneratefluxmenu |