Sunday, May 31, 2009

color prompt


# Define colors for readability
black="\[\033[0;30;49m\]"
blackgrey="\[\033[30;47m\]"
red="\[\033[1;31;49m\]"
green="\[\033[32;49m\]"
yellow="\[\033[33;49m\]"
blue="\[\033[1;34;49m\]"
magenta="\[\033[35;49m\]"
cyan="\[\033[36;49m\]"
white="\[\033[37;49m\]"
r_color="\[\033[0m\]" # Reset color
clr="\[\033[K\]" # Clear to the end of the line

if [ ${UID} -eq 0 ]; then
user="$red\u$r_color"
else
user="$blue\u$r_color"
fi

PS1="$user@\h:\w\$ "

Tuesday, May 26, 2009

Cursor movement


#!/bin/bash
# Cursor movement

function cycle {
i=30
while [ $i -le 36 ] ;
do
if [ ! $i == 33 ];
then
echo -e "$i \033[1;${i}m $i \033[1A"
sleep .3
fi
let i=i+1
done
}

t=0
while [ $t -le 3 ];
do
cycle
echo -e "\033[0m \033[1A"
let t=t+1
done

Sunday, May 10, 2009

Follow Linux kernel development with git

1. Install git. Some dists have it in repos, there are packages at http://git-scm.com/download
2. Run git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Now you have the latest snapshot + revision history back to 2.6.12-rc2 which you can update with git pull (My linux-2.6 folder is 778MB)

Check for updates on http://kernel.org/ or just finger @git.kernel.org
I put this line in my crontab:
01 16 * * * cd /files/Public/linux-2.6; /usr/bin/git pull

Ref:
http://kernel.org/
http://www.kernel.org/doc/local/git-quick.html