annotate .bashrc @ 215:bf4eb11045cc

front end for mozharness bugs
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 05 Apr 2012 09:00:34 -0700
parents 0110a435d2ce
children 4ad8bce17e85
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
27 alias ls='ls --color=auto'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
28 alias grep='grep --colour=auto'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
29 alias wget='wget --no-check-certificate'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
30 alias datestamp='date +%Y%m%d%H%M%S'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
31 alias svnst='svn st | grep -v "^\?"'
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
32 alias awd="python -c 'import os; print os.path.realpath(\".\")'"
10
9541511ed9d0 dont distribute binary eggs
k0s <k0scist@gmail.com>
parents: 0
diff changeset
33 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
34 alias random="python -c 'import sys, random; foo = sys.argv[1:]; random.shuffle(foo); print \" \".join(foo)'"
88
24f933c9d97f add an xpcshell alias, silly ubuntu installed version is fuxored
Jeff Hammel <jhammel@mozilla.com>
parents: 86
diff changeset
35 alias xpcshell="LD_LIBRARY_PATH=${MOZOBJ}/dist/bin ${MOZOBJ}/dist/bin/xpcshell"
215
bf4eb11045cc front end for mozharness bugs
Jeff Hammel <jhammel@mozilla.com>
parents: 171
diff changeset
36 alias mozharness-bug="bz new 'Release Engineering: Automation (General)' --cc ':aki' --whiteboard 'mozharness'"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
37
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
38 # PROMPT
119
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
39 PS1='│'
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
40 PS2='.'
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
41 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
42
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
43 # PATHs
147
700b43d5052e workaround firefox link problems....:(
Jeff Hammel <jhammel@mozilla.com>
parents: 144
diff changeset
44 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
45 export PYTHONPATH=~/python:$PYTHONPATH:~/virtualenv
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
46
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
47
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
48 ### functions
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
49
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
50 cdwin() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
51 # 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
52 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
53 DIR=${DIR/\~/$HOME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
54 cd $DIR
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
55 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
56
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
57 eend() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
58 # 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
59 FILE=$1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
60 shift
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
61 emacs +`wc -l "$FILE"` $@
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
144
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
64 git-diff-master() {
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
65 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
66 }
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
67
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
68 function colors() {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
69
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
70 CLR_WHITE="\033[0;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
71 CLR_WHITEBOLD="\033[1;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
72 CLR_BLACK="\033[0;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
73 CLR_GRAY="\033[1;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
74 CLR_BLUE="\033[1;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
75 CLR_BLUEBOLD="\033[0;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
76 CLR_GREEN="\033[0;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
77 CLR_GREENBOLD="\033[1;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
78 CLR_CYAN="\033[0;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
79 CLR_CYANBOLD="\033[1;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
80 CLR_RED="\033[0;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
81 CLR_REDBOLD="\033[1;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
82 CLR_PURPLE="\033[0;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
83 CLR_PURPLEBOLD="\033[1;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
84 CLR_YELLOW="\033[0;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
85 CLR_YELLOWBOLD="\033[1;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
86 CLR_NOTHING="\033[0m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
87 }
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
88 colors
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
89
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
90 # nice fast find function
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
91 EXCLUDES="(\.svn)|(\.mo$)|(\.po$)|(\.pyc$)"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
92 ff() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
93
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
94 if (( $# < 2 ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
95 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
96 FILENAME='*' # default -- look in all files
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
97 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
98 FILENAME=$2
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
99 fi
76
84ffa220796a kill all stderr from ff
Jeff Hammel <jhammel@mozilla.com>
parents: 71
diff changeset
100 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
101 # echo $CMD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
102 eval $CMD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
103
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
104 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
105
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
106 chainff() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
107 if (( $# < 2 ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
108 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
109 return 0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
110 fi
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 RESULTS=`ff "$2" "$1"`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
113 shift 2
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
114
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
115 for i in $RESULTS
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
116 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
117 for arg in $@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
118 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
119 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
120 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
121 touch /dev/null
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
122 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
123 i=""
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
124 break
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
125 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
126 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
127 if [ -n "$i" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
128 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
129 echo $i
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
130 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
131 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
132 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
133
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
134 # contextual fastfind
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
135 cff () {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
136
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
137 if (( $# < 2 )); then
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
138 local FILENAME='*' # default -- look in all files
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
139 else
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
140 local FILENAME=$2
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
141 fi
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
142
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
143 for i in `ff "$1" "$FILENAME"`; do
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
144 echo -e "$CLR_GREEN--->>> ""$CLR_YELLOWBOLD""$i""$CLR_NOTHING" :
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
145 grep --color=auto -i -n -C 3 "$1" $i
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
146 done
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
147
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
148 }
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 # make a temporary file
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
151 tmpfile() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
152
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
153 if [ "$#" == "0" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
154 then
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
155 args="tmp"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
156 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
157 args=$@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
158 fi
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 for i in $args
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
161 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
162 NEWNAME=${i}.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
163
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
164 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
165 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
166 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
167 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
168 echo "$NEWNAME"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
169 done
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
172 edpe() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
173 # 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
174 FILE=`tmpfile`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
175 $EDITOR $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
176 cat $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
177 rm $FILE
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
180 swap() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
181 # swap two files
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
182 if [ "$#" != "2" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
183 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
184 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
185 return
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
186 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
187 for i in "$1" "$2"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
188 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
189 if [ ! -w "$i" ]
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 "$FUNCNAME: Can't move $i"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
192 return 1
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 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
195
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
196 NEWNAME=`basename $1`.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
197
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
198 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
199 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
200 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
201 echo "$NEWNAME"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
202 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
203
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
204 mv `basename $1` $NEWNAME
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
205 mv `basename $2` `basename $1`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
206 mv $NEWNAME `basename $2`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
207 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
208
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
209 isrunning() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
210 # is a process running? (by name)
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
211 for i in "$@"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
212 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
213 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
214 done | sort | uniq
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 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
217
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
218 killbyname() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
219 # kill a process by name
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
220 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
221 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
222
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 tf() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
225 if [[ $@ ]]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
226 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
227 echo "true"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
228 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
229 echo "false"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
230 fi
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
233 # full name
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
234 fn() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
235 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
236 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
237
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
238 # which view
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
239 whview() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
240 less `which $@`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
241 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
242
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
243 # which emacs
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
244 whemacs() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
245 emacs -nw `which $@`
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
248 pyfile() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
249 # python file name
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
250 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
251 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
252
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
253 svndance(){
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
254 # do the svn import dance!
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
255 if (( $# ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
256 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
257 svn import $1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
258 cd ..
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
259 rm -rf $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
260 svn co $1 $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
261 cd $OLDPWD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
262 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
263 return 1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
264 fi
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
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
267 difffiles() {
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
268 grep '^+++ ' $@ | sed 's/+++ b\///'
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
269 }
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
270
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
271 hg-update-all() {
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
272 for i in *;
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
273 do
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
274 if [ -e $i/.hg ]
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
275 then
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
276 cd $i
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
277 hg pull
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
278 hg update
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
279 cd -
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
280 fi
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
281 done
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
282 }
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
283
110
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
284 hg-qcommit() {
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
285 message=$1
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
286 hg qrefresh
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
287 if [ -z "${message}" ]
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
288 then
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
289 hg qcommit
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
290 else
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
291 hg qcommit -m "${message}"
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
292 fi
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
293 hgroot=$(hg root)
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
294 patches=${hgroot}/.hg/patches/
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
295 if [ -e ${patches}.hg ]
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
296 then
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
297 cd ${patches}
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
298 hg push
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
299 fi
111
2db73718f645 change back to the old directory
Jeff Hammel <jhammel@mozilla.com>
parents: 110
diff changeset
300 cd -
110
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
301 }
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
302
90
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
303 blog-file() {
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
304 echo "$HOME/web/blog/k0s/entries/public/$1"
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
305 }
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
306
89
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
307 hgrc() {
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
308 ROOT="${1}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
309 echo "[paths]"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
310 echo "default = ${ROOT}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
311 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
312 }
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
313
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
314 flatten() {
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
315 directory=$PWD
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
316 if [ "$#" == "1" ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
317 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
318 directory=$1
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
319 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
320 cd $directory
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
321 unset find # don't use the alias
102
35d28c0a6ba3 fix find command
Jeff Hammel <jhammel@mozilla.com>
parents: 101
diff changeset
322 find . -name '*' -type f | sed 's/.\///' | while read line
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
323 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
324 filename=$(echo $line | sed 's/\//-/g')
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
325 mv "${line}" "${filename}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
326 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
327 for i in *
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
328 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
329 if [ -d $i ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
330 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
331 rm -rf "${i}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
332 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
333 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
334 }
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
335
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
336 filehandles() {
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
337 TMPFILE=$(tmpfile)
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
338 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
339 . ${TMPFILE} | sort
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
340 rm ${TMPFILE}
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
341 }
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
342
167
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
343 quotemail() {
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
344
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
345 command='s/^/> /'
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
346 inplace=""
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
347 if [ "$#" == "2" ]
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
348 then
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
349 inplace="-i"
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
350 fi
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
351
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
352 sed ${inplace} "${command}" "$1"
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 }
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
355
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
356 ### include overrides for commands
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
357 source ~/.bash_overrides
47
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
358
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
359 ### regenerate fluxbox menus here for convenience
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
360 MENU=~/web/site/programs.html
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
361 if [ -e $MENU ]
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
362 then
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
363 html2flux.py $MENU > ~/.fluxbox/applications
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
364 fi