summaryrefslogtreecommitdiff
path: root/bashrc
blob: 113760c55e782f7ca6acf51d2280a0d0ed6f0ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
body() {
    IFS= read -r header
    printf '%s\n' "$header"
    "$@"
}

safedir() {
	echo "$@ $(pwd)" | md5sum | cut -b-32
}

diffWith() {
	diffCmd=$1
	diffFile="/tmp/diffwith-$(safedir $diffCmd).patch"
	$diffCmd > $diffFile
	dos2unix -q $diffFile
	( gvim -f $diffFile ; rm $diffFile ) &
}

PATH="/usr/lib/ccache/bin:$PATH"
CORES=$(grep core\ id /proc/cpuinfo | sort -u | wc -l)
alias :e="gvim"
alias l="/bin/ls -lhvF --color"
alias grep="/bin/grep -I --color=auto --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.svn --exclude-dir=bin --exclude=tags --exclude-dir=docs/html"
alias emerge-state='watch "( ps -fC sandbox ; tail /var/log/emerge.log /var/tmp/portage/*/*/temp/build.log 2> /dev/null )"'
alias build='b2 -j$CORES $TARGET'
alias autobuild="build ; while inotifywait -qr . --exclude '/bin/|\.sw.|/\.git/' -e modify ; do clear ; printf '\e[3J' ; build ; done"
# CVS
export CVSROOT=":pserver:danielg@hawking.howden.press.net:/usr/local/src/CVS_SOURCE_TREE"
alias cvsd='diffWith "cvs diff -wubB"'
# SVN
alias svnd='diffWith "svn diff --force --no-diff-deleted -x -b"'
# Git
alias gitd='diffWith "git diff --no-prefix --relative -b -M"'
alias gitdc='diffWith "git diff --cached --no-prefix --relative -b -M"'
alias gst='git status'
# Hg
alias hgd='diffWith "hg diff -p -b"'
# Java
PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME="/usr/share/tomcat-5.5/"
export M2_HOME="/usr/share/maven-bin-3.0"

if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then
	# chroot
	if [ -e /etc/redhat-release ]; then
		ROOT=$(cat /etc/redhat-release)
	else
		ROOT="unknown chroot"
	fi
	PS1='\[\033[01;32m\]$ROOT \[\033[01;34m\]\w \$\[\033[00m\] '
	PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/\~} ($ROOT)\007"'
elif [ -z "$SSH_CONNECTION" ] ; then
	# local
	PS1='\[\033[01;34m\]\w \$\[\033[00m\] '
	PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/\~}\007"'
else
	# ssh
	PS1='\[\033[01;32m\]\h \[\033[01;34m\]\w \$\[\033[00m\] '
	PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/\~} ($HOSTNAME)\007"'
fi
PATH=$PATH:~/files/scripts/

export XAUTHORITY=~/.Xauthority
export HISTSIZE=15000
export HISTCONTROL=ignoredups
export LESSCHARSET=utf-8
export EDITOR="gvim -f"
shopt -s cdspell
shopt -s checkwinsize
shopt -s no_empty_cmd_completion

# Mounts
alias mnthome="sshfs randomdan@randomdan.homeip.net:/home/randomdan ~/home -o reconnect"
alias mntpen="sshfs danielg@penumbra.howden.press.net:/usr/local/home/danielg ~/penumbra -o reconnect"
alias mnthawk="sshfs danielg@hawking.howden.press.net:/usr/local/workarea/danielg ~/hawking -o reconnect"
alias mntasc="sshfs racing@ascot.howden.press.net:/usr/local/production/racing ~/ascot/ -o reconnect"
alias mnteps="sshfs racing@epsom.howden.press.net:/usr/local/production/racing ~/epsom/ -o reconnect"
alias mntasct="sshfs racing@ascot-test.howden.press.net:/usr/local/production/racing ~/ascot-test/ -o reconnect"
alias mntripon="sshfs racing@ripon.howden.press.net:/usr/local/production/racing ~/ripon/ -o reconnect"
alias mntldr="sshfs loaders@vbr-loader-pn1.panews.press.net:/home/loaders ~/loaders -o reconnect"
alias mntsldr="sshfs loaders@vbr-loader-pn0.panews.press.net:/isilon/pressnet_prod/loader ~/loaders -o reconnect"
# SSH
alias hawk="ssh danielg@hawking.howden.press.net"
alias pen="ssh danielg@penumbra.howden.press.net"
alias asct="ssh racing@ascot-test.howden.press.net"
alias asc="ssh racing@ascot.howden.press.net"
alias eps="ssh racing@epsom.howden.press.net"
alias ldr="ssh loaders@vbr-loader-pn1.panews.press.net"
alias sldr="ssh loaders@vbr-loader-pn0.panews.press.net"

#cd