Fun with Bash prompts

Stephen
After reading Oliver’s blog about cool bash prompts i thought id give it a go. I wanted a way to also get feedback about my current status of my git branch. After hacking around for ten minutes i came up with function _git_prompt() { local git_status="`git status -unormal 2>&1`" if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then if [[ "$git_status" =~ nothing\ to\ commit ]]; then local ansi=32 elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then local ansi=34 else local ansi=33 fi echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]' fi } function _prompt_command() { PS1="`if [ \$?

Fun with Energy Efficient Ethernet Poweredge 720 I350 Controller

Stephen
After purchasing two dell 720 machines for a project at work, I went around setting the machines up in a very basic Pacemaker cluster. Just one problem the network interface between the machines (crossover cable) would shut itself down. But the connection to the switches would be fine. The only way to get it going again was a ifdowm amd ifup, after scratching my head and looking through the device driver.

Producteev API

Stephen
My first shot at a ruby gem and api client any feedback would help. Producteev Api

Ruby Exchange lookup script for Mutt

Stephen
As i use mutt at work i had no way to lookup email address for other people. Well now i have with some nasty hacky ruby. I may clean it up etc when i have time but for now it works. Simply add this to your mutt config set query_command = "ruby -W0 {location of below script} '%s'" The -W0 is needed as there is a bug in the curb gem that i am using.

Removing Cruft From A Debian Box

Stephen
If you remove a package from a debian package and for get to add the -purge argument the package will leave its configurations files on your system. In order to view all the packages that have done this you can simply run. sudo dpkg -l | egrep "^rc"` If you wish remove those configurations files you can simple run sudo aptitude purge ~c

Zotac zBox HD-ID11

Stephen
After trying to get hdmi to work for the last 30 minutes, you can do the following Change it to the deafult card you can update /usr/share/alsa/alsa.conf and change these lines: defaults.ctl.card 0 defaults.pcm.card 0 defaults.pcm.device 0 to this: defaults.ctl.card NVidia defaults.pcm.card Nvidia defaults.pcm.device 7 Once the machine reboot check that the configs are correct in gnome mixer and it should just work.

Patches for envy 14 and Gentoo

Stephen
Here is a patch set that will get the envy14 working correct with gentoo and linux-2.6.34-gentoo-r6. They are mostly patches that i have found of the net, with some of mine sprinkled in, id credit the original authors but i have lost the links. Please comment on this posts if you know where they came from and ill give credit to the original authors. linux-patches-envy14-inux-2.6.34-gentoo-r6.tar.gz

iwlagn Unsupported (too old) EEPROM

Stephen
After purchasing a new wireless card of ebay. I found out that it was a preproduction knock off. You can see [Intels view on this ][1]. In order to get it working on linux you need to hack the driver. This is a hack and i mean a hack, it took me 2 seconds but now my wireless card is working. iwl-eeprom.c.patch --- linux-2.6.34-gentoo-r1-orig/drivers/net/wireless/iwlwifi/iwl-eeprom.c 2010-05-16 23:17:36.000000000 +0200 +++ linux-2.6.34-gentoo-r1/drivers/net/wireless/iwlwifi/iwl-eeprom.c 2010-09-02 19:04:12.

Find your ip with Bash

Stephen
I only wanted to run a script if the machine had a specific network access so i constructed this below. How to find the machines ip address ifconfig eth0 | grep "inet addr" | awk -F: '{ print $2 }' | awk '{ print $1 }' Then find out if its on a network we care about ifconfig eth0 | grep "inet addr" | awk -F: '{ print $2 }' | awk '{ print $1 }' | grep -qE '172\.