Initial import.
authorIain Patterson <me@iain.cx>
Mon, 15 Aug 2005 09:41:00 +0000 (09:41 +0000)
committerIain Patterson <me@iain.cx>
Mon, 15 Aug 2005 09:41:00 +0000 (09:41 +0000)
git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@1 6be0d1a5-5cfe-0310-89b6-964be062b18b

.bash_profile [new file with mode: 0755]
.bashrc [new file with mode: 0644]
.inputrc [new file with mode: 0755]
.profile.d/aliases.bashrc [new file with mode: 0644]
.profile.d/bash3.bashrc [new file with mode: 0644]
.profile.d/completion.bashrc [new file with mode: 0644]
.profile.d/ps1.bashrc [new file with mode: 0644]
.profile.d/ssh.bashrc [new file with mode: 0644]
.profile.d/variables.bashrc [new file with mode: 0644]
.vimrc [new file with mode: 0755]

diff --git a/.bash_profile b/.bash_profile
new file mode 100755 (executable)
index 0000000..bffd784
--- /dev/null
@@ -0,0 +1,51 @@
+for i in ~/.profile.d/*.bashrc; do . $i; done
+__ps1
+
+unset XMODIFIERS #:-(
+export SSHTERM="urxvt"
+export SSHTERM_TITLE="-title"
+export SSHTERM_EXEC="-e"
+
+if [ "$OSTYPE" = "cygwin" ]; then
+  shopt -s nocaseglob
+fi
+
+#[ "$TERM" = "xterm-color" ] && export TERM=xterm-xfree86
+export PATH=~/bin:"$PATH"
+
+function upload() {
+  if [ $# = 0 ]; then
+    echo usage: upload file [file...]
+    return 100
+  fi
+  pwd=$PWD/
+  pwd=${pwd##/home/iain/www/}
+  if echo $pwd | grep -q ^/; then
+    echo not rooted under /home/iain/www
+    unset pwd
+    return 111
+  fi
+# scp ${1+"$@"} 64.176.170.109:/home/iain/$pwd
+  lftp -c "open web1.viagold.net; cd $pwd; mput $@"
+  unset pwd
+}
+
+function download() {
+  if [ $# = 0 ]; then
+    echo usage: download file [file...]
+    return 100
+  fi
+  pwd=$PWD/
+  pwd=${pwd##/home/iain/www/}
+  if echo $pwd | grep -q ^/; then
+    echo not rooted under /home/iain/www
+    unset pwd
+    return 111
+  fi
+# scp ${1+"$@"} 64.176.170.109:/home/iain/$pwd
+  lftp -c "open web1.viagold.net; cd $pwd; mget $@"
+  unset pwd
+}
+alias debug='valgrind --leak-check=yes --show-reachable=yes --num-callers=5 --verbose'
+
+eval `dircolors -b`
diff --git a/.bashrc b/.bashrc
new file mode 100644 (file)
index 0000000..656e6ca
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,2 @@
+. /etc/profile
+. ~/.bash_profile
diff --git a/.inputrc b/.inputrc
new file mode 100755 (executable)
index 0000000..3d8708c
--- /dev/null
+++ b/.inputrc
@@ -0,0 +1,10 @@
+set editing-mode vi
+set meta-flag on
+set input-meta on
+set convert-meta off
+set output-meta on
+set bell-style none
+set show-all-if-ambiguous on
+\C-w: backward-kill-word
+\C-l: clear-screen
+$include /etc/inputrc
diff --git a/.profile.d/aliases.bashrc b/.profile.d/aliases.bashrc
new file mode 100644 (file)
index 0000000..f42a02e
--- /dev/null
@@ -0,0 +1,3 @@
+alias l='ls'
+alias ls='/bin/ls $LS_OPTIONS'
+alias vim='vim +syn\ on'
diff --git a/.profile.d/bash3.bashrc b/.profile.d/bash3.bashrc
new file mode 100644 (file)
index 0000000..19d7f1c
--- /dev/null
@@ -0,0 +1,4 @@
+#export HISTCONTROL=ignoredups
+export HISTTIMEFORMAT='[%Y-%m-%d %H:%M:%S] '
+export HISTFILESIZE=3000
+export HISTSIZE=1000
diff --git a/.profile.d/completion.bashrc b/.profile.d/completion.bashrc
new file mode 100644 (file)
index 0000000..633c86c
--- /dev/null
@@ -0,0 +1,84 @@
+# Helper!
+export COMPLETION_DIR_SSH=~/.ssh/hosts
+export COMPLETION_DIR_TELNET=~/.telnet/hosts
+export COMPLETION_DIR_RDP=~/.ssh/hosts
+export COMPLETION_DIR_PING="$COMPLETION_DIR_SSH $COMPLETION_DIR_TELNET $COMPLETION_DIR_RDP"
+
+function _generic_completion() {
+  COMPLETION_DIR=${1+"$@"}
+  COMPREPLY=()
+  cur=${COMP_WORDS[COMP_CWORD]}
+
+  HOSTS="$(find $COMPLETION_DIR -type f -perm -100 | sed 's@.*/@@')"
+
+  COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
+  return 0
+}
+
+# Process completion for killall.
+function _process() {
+  cur=${COMP_WORDS[COMP_CWORD]}
+
+  PROCESSES="$(ps agx --no-heading | awk '{ print $5 }' | sed 's@.*/@@' | sort | uniq)"
+
+  COMPREPLY=($(compgen -W "$PROCESSES" -- "$cur"))
+  return 0
+}
+
+# Process completion for kill, strace etc.
+function _pid() {
+  cur=${COMP_WORDS[COMP_CWORD]}
+
+  PROCESSES="$(find /proc -name '[0-9]*' -maxdepth 1 | sed 's@.*/@@')"
+
+  COMPREPLY=($(compgen -W "$PROCESSES" -- "$cur"))
+  return 0
+}
+
+# Complete ssh with hostnames from the Window Maker menu.
+function _ssh() {
+  _generic_completion $COMPLETION_DIR_SSH
+  return 0
+}
+
+# Complete telnet with hostnames from the Window Maker menu.
+function _telnet() {
+  _generic_completion $COMPLETION_DIR_TELNET
+  return 0
+}
+
+# Complete rdesktop with hostnames from the Window Maker menu.
+function _rdp() {
+  _generic_completion $COMPLETION_DIR_RDP
+  return 0
+}
+
+# Ping hosts from any of the above lists.
+function _ping() {
+  _generic_completion $COMPLETION_DIR_PING
+}
+
+# Hacked up make rule.
+function _make() {
+  COMPREPLY=()
+  cur=${COMP_WORDS[COMP_CWORD]}
+
+  RULES="all check clean dep depend install reinstall setup uninstall"
+
+  COMPREPLY=($(compgen -W "$RULES" -- "$cur"))
+  return 0
+}
+
+complete -F _ssh rollout
+complete -F _ssh ssh
+complete -F _ssh sshterm
+complete -F _ping telnet
+complete -F _telnet telnetterm
+complete -F _rdp rdesktop
+complete -F _ping ping
+complete -F _ping traceroute
+complete -F _ping dnsip
+complete -F _make make
+complete -F _process killall
+complete -F _pid kill
+complete -F _pid strace
diff --git a/.profile.d/ps1.bashrc b/.profile.d/ps1.bashrc
new file mode 100644 (file)
index 0000000..f5fcb6a
--- /dev/null
@@ -0,0 +1,26 @@
+# VERSION 1.2 (2001-10-31)
+#
+# coloured prompts for bash
+#
+# prompt is user@host:/dir$ where host is highlighted in green if the last 
+# command exited 0 or in red (followed by the error code) otherwise
+#
+# to use, add a call to __ps1 in your .bash_profile
+
+export PROMPT_OK_COLOUR=32
+export PROMPT_FAILED_COLOUR=31
+
+function __ps1() {
+  export PS1='\u@\[\033[1;$(__ps1_col $?)m\]\h\[\033[0m\]$(__ps1_ret $?):\w\$ '
+  return 0
+}
+
+function __ps1_col() {
+  [ $1 -gt 0 ] && echo -n "$PROMPT_FAILED_COLOUR" || echo -n "$PROMPT_OK_COLOUR"
+  return $1
+}
+
+function __ps1_ret() {
+  [ $1 -gt 0 ] && echo -n " ($1)"
+  return 0
+}
diff --git a/.profile.d/ssh.bashrc b/.profile.d/ssh.bashrc
new file mode 100644 (file)
index 0000000..9aac92c
--- /dev/null
@@ -0,0 +1,25 @@
+if [ ! -z "$SSH_CLIENT" ]; then
+  # Set display if we aren't already forwarding X11
+  if [ "$DISPLAY" = "" ]; then
+    export DISPLAY="$(echo $SSH_CLIENT | cut -s -d ' ' -f 1):0"
+  fi
+fi
+
+# Try to hook up with already running ssh-agent.
+if [ $UID -gt 0 ]; then
+  RUNNING_AGENT="$(ps waux | grep -- ^$USER\ .\*ssh-agent\ -s | grep -v grep | awk '{ print $2 }' | head -n 1)"
+  if [ -z "$SSH_AGENT_PID" -o ! "$SSH_AGENT_PID" = "$RUNNING_AGENT" ]; then
+    export SSH_AGENT_PID="$RUNNING_AGENT"
+    if [ "$SSH_AGENT_PID" = "" ]; then
+      unset SSH_AGENT_PID
+      unset SSH_AUTH_SOCK
+      # Start ssh-agent up then.
+      eval $(/usr/bin/ssh-agent -s)
+      trap "kill $SSH_AGENT_PID" 0
+      ssh-add
+    else
+      export SSH_AUTH_SOCK="/$(lsof -p $SSH_AGENT_PID | grep 'agent.[0-9]*$' | cut -s -d / -f 2-)"
+    fi
+  fi
+  unset RUNNING_AGENT
+fi
diff --git a/.profile.d/variables.bashrc b/.profile.d/variables.bashrc
new file mode 100644 (file)
index 0000000..6e1133d
--- /dev/null
@@ -0,0 +1,9 @@
+export SSHTERM=urxvtc
+export SSHTERM_TITLE=-title
+export SSHTERM_EXEC=-e
+#export TERM=xterm-xfree86
+export TERM=linux
+export LC_CTYPE=en_GB
+export LS_OPTIONS="--color=auto -F -b"
+export VISUAL=vim
+eval `dircolors`
diff --git a/.vimrc b/.vimrc
new file mode 100755 (executable)
index 0000000..d6c717f
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,29 @@
+se ts=2
+se bs=2
+se sw=2
+se expandtab
+se ruler
+se cindent
+se cinkeys=0{,0},0),:,!^F,o,O,e
+se showcmd
+se go=agilmrtT
+se incsearch
+se ignorecase
+se smartcase
+se shm=aot
+syn enable
+if has("gui_running")
+  se guifont=Bitstream\ Vera\ Sans\ Mono\ 12
+  colo darkblue
+endif
+if has("win32")
+  se guifont=Bitstream_Vera_Sans_Mono:h10:cANSI
+endif
+map <C-"> viwvbi"<ESC>ea"<ESC>
+map - yyp:s/./-/g<RETURN>:let @/=''<RETURN>:<RETURN>
+map = yyp:s/./=/g<RETURN>:let @/=''<RETURN>:<RETURN>
+command W :w
+:autocmd!
+autocmd Syntax c se cinkeys=0{,0},0),:,0#,!^F,o,O,e
+autocmd Syntax perl se cinkeys=0{,0},0),:,!^F,o,O,e
+autocmd Syntax php se cinkeys=0{,0},0),:,!^F,o,O,e