annotate .bashrc @ 278:500fff4e28c9

menuitem key; shoulda let go of L
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 01 May 2013 17:25:25 -0700
parents 102305dad796
children 19070b2af257
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
7 # Shell is non-interactive. Be done now!
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
8 return
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
13 eval $(dircolors -b ~/.dir_colors)
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
15 eval $(dircolors -b /etc/DIR_COLORS)
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
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
19 export CLICOLOR=1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
20 export EDITOR='emacs -nw'
171
0110a435d2ce use a directory for mozconfigs
Jeff Hammel <jhammel@mozilla.com>
parents: 169
diff changeset
21 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
22 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
23 export MOZOBJ=~/mozilla/src/obj-browser
86
e1ec232bd0a1 add variable so i get readline with xpcshell
Jeff Hammel <jhammel@mozilla.com>
parents: 84
diff changeset
24 export JS_EDITLINE=1
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
25
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
26 # aliases
250
6f3d12f17847 order aliases
Jeff Hammel <jhammel@mozilla.com>
parents: 246
diff changeset
27 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
28 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
29 alias datestamp='date +%Y%m%d%H%M%S'
250
6f3d12f17847 order aliases
Jeff Hammel <jhammel@mozilla.com>
parents: 246
diff changeset
30 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
31 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
32 alias ls='ls --color=auto'
250
6f3d12f17847 order aliases
Jeff Hammel <jhammel@mozilla.com>
parents: 246
diff changeset
33 alias random="python -c 'import sys, random; foo = sys.argv[1:]; random.shuffle(foo); print \" \".join(foo)'"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
34 alias svnst='svn st | grep -v "^\?"'
250
6f3d12f17847 order aliases
Jeff Hammel <jhammel@mozilla.com>
parents: 246
diff changeset
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
bed50e028005 front-end for releng bug
Jeff Hammel <jhammel@mozilla.com>
parents: 240
diff changeset
37
bed50e028005 front-end for releng bug
Jeff Hammel <jhammel@mozilla.com>
parents: 240
diff changeset
38 # bzconsole aliases for filing bugs
bed50e028005 front-end for releng bug
Jeff Hammel <jhammel@mozilla.com>
parents: 240
diff changeset
39 alias mozbase-bug="bz new Mozbase --cc ':wlach'"
215
bf4eb11045cc front end for mozharness bugs
Jeff Hammel <jhammel@mozilla.com>
parents: 171
diff changeset
40 alias mozharness-bug="bz new 'Release Engineering: Automation (General)' --cc ':aki' --whiteboard 'mozharness'"
241
bed50e028005 front-end for releng bug
Jeff Hammel <jhammel@mozilla.com>
parents: 240
diff changeset
41 alias releng-bug="bz new 'Release Engineering: Automation (General)'"
217
4ad8bce17e85 shortcut for talos bugs
Jeff Hammel <jhammel@mozilla.com>
parents: 215
diff changeset
42 alias talos-bug="bz new Talos --cc ':jmaher' --cc ':BYK'"
260
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
43 alias mozbuild-bug="bz new --product Core 'Build Config' --cc ':gps'"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
44
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
45 # PROMPT
119
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
46 PS1='│'
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
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
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
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
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
54
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
55 ### functions
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
56
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
57 cdwin() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
58 # 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
59 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
60 DIR=${DIR/\~/$HOME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
61 cd $DIR
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
62 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
63
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
64 eend() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
65 # edit the end of a file with emacs
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
66 FILE=$1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
67 shift
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
68 emacs +`wc -l "$FILE"` $@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
69 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
70
144
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
71 git-diff-master() {
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
72 git diff $(git merge-base HEAD master)
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
73 }
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
74
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
75 function colors() {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
76
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
77 CLR_WHITE="\033[0;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
78 CLR_WHITEBOLD="\033[1;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
79 CLR_BLACK="\033[0;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
80 CLR_GRAY="\033[1;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
81 CLR_BLUE="\033[1;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
82 CLR_BLUEBOLD="\033[0;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
83 CLR_GREEN="\033[0;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
84 CLR_GREENBOLD="\033[1;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
85 CLR_CYAN="\033[0;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
86 CLR_CYANBOLD="\033[1;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
87 CLR_RED="\033[0;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
88 CLR_REDBOLD="\033[1;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
89 CLR_PURPLE="\033[0;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
90 CLR_PURPLEBOLD="\033[1;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
91 CLR_YELLOW="\033[0;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
92 CLR_YELLOWBOLD="\033[1;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
93 CLR_NOTHING="\033[0m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
94 }
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
95 colors
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
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
84ffa220796a kill all stderr from ff
Jeff Hammel <jhammel@mozilla.com>
parents: 71
diff changeset
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
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
141 # contextual fastfind
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
142 cff () {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
143
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
144 if (( $# < 2 )); then
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
145 local FILENAME='*' # default -- look in all files
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
146 else
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
147 local FILENAME=$2
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
148 fi
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
149
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
150 for i in `ff "$1" "$FILENAME"`; do
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
151 echo -e "$CLR_GREEN--->>> ""$CLR_YELLOWBOLD""$i""$CLR_NOTHING" :
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
152 grep --color=auto -i -n -C 3 "$1" $i
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
153 done
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
154
260
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
155 }
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
156
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
157 # make a temporary file
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
160 if [ "$#" == "0" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
161 then
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
162 args="tmp"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
163 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
164 args=$@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
165 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
166
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
167 for i in $args
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
168 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
169 NEWNAME=${i}.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
170
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
171 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
172 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
173 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
174 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
175 echo "$NEWNAME"
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() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
180 # edit and pipe the buffer to stdout
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
181 FILE=`tmpfile`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
182 $EDITOR $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
183 cat $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
184 rm $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
185 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
186
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
187 swap() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
188 # swap two files
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
189 if [ "$#" != "2" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
190 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
191 echo "Usage: $FUNCNAME <first_arg> <second_arg>"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
192 return
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
193 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
194 for i in "$1" "$2"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
195 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
196 if [ ! -w "$i" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
197 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
198 echo "$FUNCNAME: Can't move $i"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
199 return 1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
200 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
201 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
202
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
203 NEWNAME=`basename $1`.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
204
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
205 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
206 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
207 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
208 echo "$NEWNAME"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
209 done
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 mv `basename $1` $NEWNAME
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
212 mv `basename $2` `basename $1`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
213 mv $NEWNAME `basename $2`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
214 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
215
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
216 isrunning() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
217 # is a process running? (by name)
274
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
218 # see also: talos for a better version
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
219 for i in "$@"
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 ps axwww | grep "$i" | grep -v 'grep'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
222 done | sort | uniq
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
223
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
224 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
225
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
226 killbyname() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
227 # kill a process by name
274
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
228 # see also: talos for a better version
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
229 kill `isrunning "$@" | awk '{ print $1 }' | onelineit.py`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
230 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
231
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
232 # full name
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
233 fn() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
234 python -c "import os; print os.path.realpath('$*')"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
235 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
236
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
237 # which view
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
238 whview() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
239 less `which $@`
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
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
242 # which emacs
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
243 whemacs() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
244 emacs -nw `which $@`
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
247 pyfile() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
248 # python file name
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
249 python -c "import $1; print $1.__file__"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
250 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
251
260
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
252 ### 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
253
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
254 svndance(){
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
255 # do the svn import dance!
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
256 if (( $# ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
257 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
258 svn import $1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
259 cd ..
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
260 rm -rf $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
261 svn co $1 $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
262 cd $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
263 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
264 return 1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
265 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
266 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
267
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
268 difffiles() {
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
269 grep '^+++ ' $@ | sed 's/+++ b\///'
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
270 }
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
271
260
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
272 hg-update-all() {
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
273 for i in *;
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
274 do
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
275 if [ -e $i/.hg ]
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
276 then
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
277 cd $i
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
278 hg pull
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
279 hg update
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
280 cd -
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
281 fi
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
282 done
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
283 }
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
284
110
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
285 hg-qcommit() {
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
286 message=$1
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
287 hg qrefresh
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
288 if [ -z "${message}" ]
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
289 then
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
290 hg qcommit
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
291 else
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
292 hg qcommit -m "${message}"
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
293 fi
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
294 hgroot=$(hg root)
240
a5a27ec28ea7 add an alias for mozbase bugs
Jeff Hammel <jhammel@mozilla.com>
parents: 237
diff changeset
295 patches=${hgroot}/.hg/patches/
110
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
296 if [ -e ${patches}.hg ]
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
297 then
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
298 cd ${patches}
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
299 hg push
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
300 fi
111
2db73718f645 change back to the old directory
Jeff Hammel <jhammel@mozilla.com>
parents: 110
diff changeset
301 cd -
110
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
302 }
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
303
89
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
304 hgrc() {
274
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
305 # write an hgrc file
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
306 # TODO: in the case you're in an `hg root`...what then?
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
307 # - NOTE: /home/jhammel is an `hg root`, so be careful!
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
308 # There should be a way to update $(hg root)/.hg/hgrc automatically
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
309 # Likewise, git
102305dad796 fun notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 260
diff changeset
310 # 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
311 ROOT="${1}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
312 echo "[paths]"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
313 echo "default = ${ROOT}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
314 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
315 }
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
316
260
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
317 ### functions for web content
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
318
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
319 blog-file() {
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
320 echo "$HOME/web/blog/k0s/entries/public/$1"
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
321 }
eacc4c5ed628 add an alias for mozbuild bugs and cleanup a bit
Jeff Hammel <jhammel@mozilla.com>
parents: 250
diff changeset
322
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
323 flatten() {
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
324 directory=$PWD
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
325 if [ "$#" == "1" ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
326 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
327 directory=$1
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
328 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
329 cd $directory
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
330 unset find # don't use the alias
102
35d28c0a6ba3 fix find command
Jeff Hammel <jhammel@mozilla.com>
parents: 101
diff changeset
331 find . -name '*' -type f | sed 's/.\///' | while read line
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
332 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
333 filename=$(echo $line | sed 's/\//-/g')
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
334 mv "${line}" "${filename}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
335 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
336 for i in *
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
337 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
338 if [ -d $i ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
339 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
340 rm -rf "${i}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
341 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
342 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
343 }
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
344
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
345 filehandles() {
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
346 TMPFILE=$(tmpfile)
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
347 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
348 . ${TMPFILE} | sort
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
349 rm ${TMPFILE}
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
350 }
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
351
167
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
352 quotemail() {
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
353
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
354 command='s/^/> /'
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
355 inplace=""
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
356 if [ "$#" == "2" ]
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
357 then
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
358 inplace="-i"
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
359 fi
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
360
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
361 sed ${inplace} "${command}" "$1"
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
362
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
363 }
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
364
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
365 ### include overrides for commands
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
366 source ~/.bash_overrides
47
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
367
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
368 ### regenerate fluxbox menus here for convenience
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
369 MENU=~/web/site/programs.html
237
b33d0c78132c move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents: 224
diff changeset
370 regeneratefluxmenu() {
47
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
371 if [ -e $MENU ]
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
372 then
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
373 html2flux.py $MENU > ~/.fluxbox/applications
222
d963d5a7e543 https://bugzilla.mozilla.org/show_bug.cgi?id=754703
Jeff Hammel <jhammel@mozilla.com>
parents: 217
diff changeset
374 fi
237
b33d0c78132c move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents: 224
diff changeset
375 }
b33d0c78132c move menu regeneration to its own function
Jeff Hammel <jhammel@mozilla.com>
parents: 224
diff changeset
376 regeneratefluxmenu