annotate .bashrc @ 234:761e7dfc675e

updates from most recent usage
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 09 Aug 2012 12:54:12 -0700
parents 57677a2bf772
children b33d0c78132c
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'"
217
4ad8bce17e85 shortcut for talos bugs
Jeff Hammel <jhammel@mozilla.com>
parents: 215
diff changeset
37 alias talos-bug="bz new Talos --cc ':jmaher' --cc ':BYK'"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
38
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
39 # PROMPT
119
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
40 PS1='│'
dc3c8f90a418 * a new prompt!
Jeff Hammel <jhammel@mozilla.com>
parents: 111
diff changeset
41 PS2='.'
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
42 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
43
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
44 # PATHs
147
700b43d5052e workaround firefox link problems....:(
Jeff Hammel <jhammel@mozilla.com>
parents: 144
diff changeset
45 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
46 export PYTHONPATH=~/python:$PYTHONPATH:~/virtualenv
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
47
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
48
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
49 ### functions
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
50
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
51 cdwin() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
52 # 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
53 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
54 DIR=${DIR/\~/$HOME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
55 cd $DIR
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
58 eend() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
59 # 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
60 FILE=$1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
61 shift
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
62 emacs +`wc -l "$FILE"` $@
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
144
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
65 git-diff-master() {
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
66 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
67 }
c9577c9af631 add a command for the alias i always forget
Jeff Hammel <jhammel@mozilla.com>
parents: 119
diff changeset
68
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
69 function colors() {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
70
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
71 CLR_WHITE="\033[0;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
72 CLR_WHITEBOLD="\033[1;37m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
73 CLR_BLACK="\033[0;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
74 CLR_GRAY="\033[1;30m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
75 CLR_BLUE="\033[1;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
76 CLR_BLUEBOLD="\033[0;34m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
77 CLR_GREEN="\033[0;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
78 CLR_GREENBOLD="\033[1;32m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
79 CLR_CYAN="\033[0;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
80 CLR_CYANBOLD="\033[1;36m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
81 CLR_RED="\033[0;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
82 CLR_REDBOLD="\033[1;31m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
83 CLR_PURPLE="\033[0;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
84 CLR_PURPLEBOLD="\033[1;35m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
85 CLR_YELLOW="\033[0;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
86 CLR_YELLOWBOLD="\033[1;33m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
87 CLR_NOTHING="\033[0m"
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
88 }
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
89 colors
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
90
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
91 # nice fast find function
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
92 EXCLUDES="(\.svn)|(\.mo$)|(\.po$)|(\.pyc$)"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
93 ff() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
94
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
95 if (( $# < 2 ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
96 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
97 FILENAME='*' # default -- look in all files
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
98 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
99 FILENAME=$2
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
100 fi
76
84ffa220796a kill all stderr from ff
Jeff Hammel <jhammel@mozilla.com>
parents: 71
diff changeset
101 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
102 # echo $CMD
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
103 eval $CMD
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
107 chainff() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
108 if (( $# < 2 ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
109 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
110 return 0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
111 fi
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 RESULTS=`ff "$2" "$1"`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
114 shift 2
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
115
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
116 for i in $RESULTS
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
117 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
118 for arg in $@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
119 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
120 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
121 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
122 touch /dev/null
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
123 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
124 i=""
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
125 break
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
126 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
127 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
128 if [ -n "$i" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
129 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
130 echo $i
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
131 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
132 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
133 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
134
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
135 # contextual fastfind
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
136 cff () {
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
137
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
138 if (( $# < 2 )); then
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
139 local FILENAME='*' # default -- look in all files
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
140 else
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
141 local FILENAME=$2
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
142 fi
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 for i in `ff "$1" "$FILENAME"`; do
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
145 echo -e "$CLR_GREEN--->>> ""$CLR_YELLOWBOLD""$i""$CLR_NOTHING" :
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
146 grep --color=auto -i -n -C 3 "$1" $i
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
147 done
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
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
151 # make a temporary file
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
152 tmpfile() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
153
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
154 if [ "$#" == "0" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
155 then
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
156 args="tmp"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
157 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
158 args=$@
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
159 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
160
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
161 for i in $args
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
162 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
163 NEWNAME=${i}.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
164
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
165 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
166 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
167 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
168 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
169 echo "$NEWNAME"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
170 done
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
173 edpe() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
174 # 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
175 FILE=`tmpfile`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
176 $EDITOR $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
177 cat $FILE
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
178 rm $FILE
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
181 swap() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
182 # swap two files
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
183 if [ "$#" != "2" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
184 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
185 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
186 return
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
187 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
188 for i in "$1" "$2"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
189 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
190 if [ ! -w "$i" ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
191 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
192 echo "$FUNCNAME: Can't move $i"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
193 return 1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
194 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
195 done
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
196
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
197 NEWNAME=`basename $1`.$RANDOM
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
198
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
199 while [ -e $NEWNAME ]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
200 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
201 NEWNAME=${NEWNAME}.tmp
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
202 echo "$NEWNAME"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
203 done
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 mv `basename $1` $NEWNAME
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
206 mv `basename $2` `basename $1`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
207 mv $NEWNAME `basename $2`
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
210 isrunning() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
211 # 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
212 for i in "$@"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
213 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
214 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
215 done | sort | uniq
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
219 killbyname() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
220 # kill a process by name
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
221 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
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
225 tf() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
226 if [[ $@ ]]
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
227 then
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
228 echo "true"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
229 else
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
230 echo "false"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
231 fi
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
234 # full name
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
235 fn() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
236 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
237 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
238
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
239 # which view
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
240 whview() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
241 less `which $@`
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
242 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
243
66
91746c8abe0f cleanup .bashrc
Jeff Hammel <jhammel@mozilla.com>
parents: 47
diff changeset
244 # which emacs
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
245 whemacs() {
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
246 emacs -nw `which $@`
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
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
249 pyfile() {
71
3d111401010f add a function to view the files in a diff
Jeff Hammel <jhammel@mozilla.com>
parents: 67
diff changeset
250 # python file name
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
251 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
252 }
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
253
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
84
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
272 hg-update-all() {
7ddb611ba0c1 add update all command
Jeff Hammel <jhammel@mozilla.com>
parents: 76
diff changeset
273 for i in *;
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)
bf567a0e8fef add a hg-qcommit that does the right thing
Jeff Hammel <jhammel@mozilla.com>
parents: 103
diff changeset
295 patches=${hgroot}/.hg/patches/
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
90
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
304 blog-file() {
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
305 echo "$HOME/web/blog/k0s/entries/public/$1"
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
306 }
6d09c2a8e5e9 * add a blog file function
Jeff Hammel <jhammel@mozilla.com>
parents: 89
diff changeset
307
89
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
308 hgrc() {
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
309 ROOT="${1}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
310 echo "[paths]"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
311 echo "default = ${ROOT}"
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
312 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
313 }
dfda4f7d4db4 add a command to generate those hgrc files i always need
Jeff Hammel <jhammel@mozilla.com>
parents: 88
diff changeset
314
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
315 flatten() {
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
316 directory=$PWD
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
317 if [ "$#" == "1" ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
318 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
319 directory=$1
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
320 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
321 cd $directory
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
322 unset find # don't use the alias
102
35d28c0a6ba3 fix find command
Jeff Hammel <jhammel@mozilla.com>
parents: 101
diff changeset
323 find . -name '*' -type f | sed 's/.\///' | while read line
101
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
324 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
325 filename=$(echo $line | sed 's/\//-/g')
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
326 mv "${line}" "${filename}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
327 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
328 for i in *
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
329 do
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
330 if [ -d $i ]
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
331 then
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
332 rm -rf "${i}"
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
333 fi
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
334 done
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
335 }
8b15a38ccd0f * fix vpns
Jeff Hammel <jhammel@mozilla.com>
parents: 90
diff changeset
336
103
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
337 filehandles() {
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
338 TMPFILE=$(tmpfile)
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
339 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
340 . ${TMPFILE} | sort
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
341 rm ${TMPFILE}
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
342 }
e841c419199e add process command to get filehandles
Jeff Hammel <jhammel@mozilla.com>
parents: 102
diff changeset
343
167
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
344 quotemail() {
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
345
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
346 command='s/^/> /'
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
347 inplace=""
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
348 if [ "$#" == "2" ]
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
349 then
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
350 inplace="-i"
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
351 fi
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
352
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
353 sed ${inplace} "${command}" "$1"
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 }
842e1fca024a add a quotemail function for quoting mail
Jeff Hammel <jhammel@mozilla.com>
parents: 147
diff changeset
356
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
357 ### include overrides for commands
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
358 source ~/.bash_overrides
47
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
359
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
360 ### regenerate fluxbox menus here for convenience
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
361 MENU=~/web/site/programs.html
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
362 if [ -e $MENU ]
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
363 then
a0636527f809 regenerate fluxbox menus on shell
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
364 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
365 fi