Archive for June 2009

Create an extremely simple battery monitor for dzen2.

I have this really simple bash/dzen2 script I’d like to share. It basically displays how much battery there is left as a dzen2 bar.

So here is the script:

#!/bin/bash
# A very simple battery monitor script.
current=`grep remaining /proc/acpi/battery/BAT0/state | awk {'print $3'}`
full=`grep full /proc/acpi/battery/BAT0/info | awk {'print $4'}`
percent=`echo "($current*100)/$full" | bc`
echo $percent | gdbar -ss 1 -h 10 -w 90 -fg 'orange' -bg '#222222' | dzen2 -p 3 -w 90 -h 10 -x 1188 -y 18

I have placed this script in ~/bin and bound it to +b in my xmonad.hs.

Here is how it looks:

My Computing History

I’ve been brought up with computers. I remember in the mid eighties when my dad one day had this very big metal box with him home from his job. It was in fact the legendary IBM 5160 with had a 8086 CPU, 10 MB’s of hard drive space, 640kb’s ram, and the amazing clock freq at 5 mhz. I remember this computer being very expensive – about $10.000 IIRC.

I remember playing Digger, Larry, Kings Quest and Styx and generally spending a lot of time in the basement and having a great time. Larry learned me a lot of the English language especially interesting words like prophylactics, prostitute, liquor, and STD.

In the early nineties I lost interest in PC’s since I got an Amiga 500. What a great machine that was. I never got a harddrive for it, so it was mainly used for gaming and creating music with ProTracker. The music part did not go to well, so most of the time was used to play RPG’s like Champions of Krynn, EOB 1+2 and Black Crypt.

In the late nineties I got a bamboo PC with a 486 50 Mhz CPU, 8 Mbs of ram and about 60 Mbs of HD. It ran Windows 95 and was mainly used for school work and (you guessed right) gaming. I used this piece of sh*tty hardware for too many years until it finally buckled and I did not own a PC for several years.

Fast forward to the end of my studies at the university. I was writing my thesis on Cronenberg and Marshall McLuhan on a old Acer Laptop, which was really slow and I thought I needed to somehow speed it up and be more productive and Linux would be obvious choice. This thought was actually procrastination in disguise as it turned out. In the next four months I went through a throng of distros (including DSL, BLAG, Zenwalk, Xubuntu and Puppy Linux) and not really producing any text. Most of them did work fine, but were sort of unintuitive when handling software installation. I was bitten by the Linux bug, but I had to finish my thesis, so I went back to TinyXP for while to do so.

After finishing my studies I was without a job and what better way to spend your time than to tinker with Linux? During this phase was when I found Arch. Arch was pretty hard to install at first and it took a very long time, probably because I did not read the documentation properly which led me to use the throttled Arch ftp as my repository. Once I got through these hurdles I began exploring WM’s in the approximate following order: xfce, fluxbox, openbox, dwm, awesome, XMonad. I now use XMonad full time and struggling to learn Haskell so I can fully comprehend what goes on in xmonad.hs, but it is not a chore – IT’S FUN.

This is also where I got acquainted with LaTeX and I wrote all my job applications in TeX. (If anyone needs a good template for a job application please drop me a note)

All these applications produced in TeX payed of and I now work in one of the largest IT Companies in my country and I’ve been offered a trainee position in our Unix department when there is an opening. So my interest in Linux has given me a lot. The joy of computing, a job (and a possible future working with Unix) and of course Arch Linux.