A guy, a blog and the internet
Archive for April, 2008
New bash prompt
Apr 29th
Well finally got my color bash prompt working
__vcs_dir() {
local vcs base_dir sub_dir ref
sub_dir() {
local sub_dir
sub_dir=$(readlink -f “${PWD}”)
sub_dir=${sub_dir#$1}
echo ${sub_dir#/}
}
git_dir() {
base_dir=$(git-rev-parse –show-cdup 2>/dev/null) || return 1
if [ -d '.git' ]; then base_dir=$(readlink -f ‘.’);
else base_dir=$(readlink -f “$base_dir”);
fi;
sub_dir=$(git-rev-parse –show-prefix)
sub_dir=${sub_dir%/}
ref=$(git-symbolic-ref -q HEAD || git-name-rev –name-only HEAD 2>/dev/null)
ref=${ref#refs/heads/}
vcs=”git”
}
svn_dir() {
[ -d ".svn" ] || return 1
base_dir=”.”
while [ -d "$base_dir/../.svn" ]; do base_dir=”$base_dir/..”; done
base_dir=$(readlink -f “$base_dir”)
sub_dir=$(sub_dir “${base_dir}”)
ref=$(svn info “$base_dir” | awk ‘/^URL/ { sub(“.*/”,”",$0); r=$0 } /^Revision/ { sub(“[^0-9]*”,”",$0); print r”:”$0 }’)
vcs=”svn”
}
svk_dir() {
[ -f ~/.svk/config ] || return 1
base_dir=$(awk ‘/: *$/ { sub(/^ */,”",$0); sub(/: *$/,”",$0); if (match(“‘${PWD}’”, $0″(/|$)”)) { print $0; d=1; } } /depotpath/ && d == 1 { sub(“.*/”,”",$0); r=$0 } /revision/ && d == 1 { print r “:” $2; exit 1 }’ ~/.svk/config) && return 1
ref=${base_dir##*
}
base_dir=${base_dir%%
*}
sub_dir=$(sub_dir “${base_dir}”)
vcs=”svk”
}
hg_dir() {
base_dir=”.”
while [ ! -d "$base_dir/.hg" ]; do base_dir=”$base_dir/..”; [ $(readlink -f "${base_dir}") = "/" ] && return 1; done
base_dir=$(readlink -f “$base_dir”)
sub_dir=$(sub_dir “${base_dir}”)
ref=$(< “${base_dir}/.hg/branch”)
vcs=”hg”
}
git_dir ||
svn_dir ||
svk_dir ||
hg_dir ||
base_dir=”$PWD”
if [ -n “${vcs}” ]; then
__vcs_prefix=${vcs}
__vcs_base_dir=${base_dir/$HOME/~}
__vcs_ref=${ref}
__vcs_sub_dir=${sub_dir}
else
__vcs_prefix=”
__vcs_base_dir=”${PWD/$HOME/~}”
__vcs_ref=”
__vcs_sub_dir=”
__vcs_sub_dir=”
fi
}
PROMPT_COMMAND=__vcs_dir
PS1=’${debian_chroot:+(${debian_chroot})}\[\e[1;32m\]\u\[\e[1;37m\]@\[\e[1;31m\]\h\[\e[1;37m\]:${__vcs_prefix:+\[\e[1;33m\](${__vcs_prefix})}\[\e[1;34m\]${__vcs_base_dir/$HOME/~}${__vcs_ref:+\[\e[1;37m\][${__vcs_ref}]}${__vcs_sub_dir:+\[\e[1;34m\]${__vcs_sub_dir}}\[\e[1;37m\]\$\[\e[0m\] ‘
STFU @ comment spambots
Apr 29th
Well I’ve disabled comments for now… well until I can add an anti spam feature
If people used all the energy that they use to fill the internet with spam, for good the world would be a better place!!!
Wireless and stuff…
Apr 24th
Well the other day (probably like a week ago now), I got a wlan dongle for Cecilia’s laptop, and it works pretty well, well it does now after adding WEP to my router… (the dongle only supports WEP, it says it does WPA but on testing it didn’t work)
So now the wireless has an extra layer of security, MAC filter + WEP… Really need to upgrade this thing… thinking about the openwrt project
As for the Debian side of things, her dongle works under debian, it’s using the RALink chipset
on another note, I need to doc this some where, to switch on the wireless led, and kill the radio on the ipw2200:
echo 1 > /sys/bus/pci/drivers/ipw2200/0000\:03\:03.0/led
echo 1 > /sys/bus/pci/drivers/ipw2200/0000\:03\:03.0/rf_kill
New Phone – Nokia E51
Apr 19th
So I got a new phone (contract upgrade), I’m really enjoying this phone.
It has wifi which is nice, means I can do alot of things at home without using 3G or gprs…
New styles
Apr 11th
Well another style, and I kinda like this one a lot…
Lets see how long this one lasts…
Happy 1st Birthday
Apr 8th
Today is my little princess’ 1st birthday
I can’t believe that time flies so fast…
I know you can’t read, but again… Happy Birthday my angel