Update 2010-01-05
I tried using the VNC mode and it choked and died, making me re-download a bunch of stuff when I ran it in text mode. Just an FYI, not saying it will happen to you, but warning that it might. Honestly, I didn’t see much difference running in VNC vs. Text, you get the same options.
It appears that over the internet installation is no longer a recommended way to get CentOS. However, I can not for the life of me convince my DVD burner to write the CentOS 5.4 ISO. I did however have a live CD. So I found a nice guide for 5.3 NetInstall and adapted it, very very little has changed.
The mirror list is here and it just so happens that UNL is a full mirror. So, thanks UNL!
Posted January 5th, 2010 - PermalinkI created a team for Little Filament on Folding@home. Our team number is 172406 (in case you want to join), but I wanted to add our latest stats on the Little Filament site. As far as I can tell there is no API for the stats, so I worked up a scraper in bash.
Basically all it does is fetch the page, then grep and sed it’s way to the variables, finally dumping them into a json file (for easy JavaScript consumption).
The kicker is that the stats server is overloaded or down a lot, so we can’t rely on it and we don’t want to stress it out further. My decision was to poll it at a large interval, 12-24 hours. I don’t have enough clients on the team to exact significant change over 6-12 hours, but I don’t want to fall too far out of date either. So if the server is overloaded and drops it once or twice, not a big deal.
Without further ado, here is the script.
#!/bin/bash NOW=$(date +%s) THEN=$(cat fah_check.lock | tr -d '\n') if [ $NOW -gt $(($THEN + 86400)) ]; then wget "http://fah-web.stanford.edu/cgi-bin/main.py?qtype=teampage&teamnum=172406" -O fah_check.html if [ "$?" == "0" ]; then grep "Grand Score" fah_check.html > /dev/null 2&>1 if [ "$?" == "0" ]; then SCORE=$(grep -C 2 "Grand Score" fah_check.html | sed 's/[^0-9]//gm' | tr -d '\n') WU=$(grep -C 2 "Work Unit Count" fah_check.html | sed 's/[^0-9]//gm' | tr -d '\n') RANK=$(grep -C 1 "Team Ranking" fah_check.html | sed 's/[^0-9of]//gm' | tr -d '\n' | sed 's/f\([0-9]*\)of\([0-9]*\)/\1 of \2/') echo "{\"score\": \"$SCORE\", \"work_units\": \"$WU\", \"rank\": \"$RANK\" }" > fah_check.json echo "[$NOW] - Success!" >> fah_check.log echo $NOW > fah_check.lock else echo "[$NOW] - Filter Failed" >> fah_check.log fi else echo "[$NOW] - Download Failed" >> fah_check.log fi else echo "[$NOW] - Skip Update" >> fah_check.log fi
That cranks out fah_check.json, which looks like this:
{"score": "4355", "work_units": "20", "rank": "39881 of 169721" }
To see it in action, check out the Little Filament Folding page.
Posted December 11th, 2009 - PermalinkI tend to write little tidbits that I like to use in KDE fairly often, or custom shortcuts for launching applications. Every time I do this though, I forget how I got the last one to show up in krunner. This is just a quick guide to what I do, to remind myself and to show you.
1. Move script to somewhere in my path (I use ~/System/bin for no apparent reason)
2. Create a .desktop file
3. Move .desktop file to ~/.kde/share/applnk/
4. Run kbuildsycoca4 to rebuild the KDE4 cache
5. Restart krunner.
I also came across kappfinder, pictured below, that finds applications that aren’t in the menu system for some reason (only added to Gnome or something). Not useful for this application, but handy to know, and related.

I was working on a screen cast for a project and I could not get anything to work the way I wanted to. I didn’t have the desire to purchase software, so I sought a way to annotate it for free. I tried a half dozen free and open source video editors, with no real luck. Either they choked on the format I captured (from CamStudio) or they didn’t have a readily available inline text tool.
What I ended up using was plain old subtitles, plus the handyman’s secret weapon, mplayer/mencoder.
Here’s what I did. I fired up the video in VLC and found the points where I wanted to put my subtitle help text. Subtitle files are usually pretty straight forward. I chose the .srt format, which is plain text. You can edit by hand, or you can use a tool, I used the aptly named subtitleeditor. Which, by the way, barfed on my video file.
Here’s a snippet of the resulting .srt file:
1 00:00:00,000 --> 00:00:13,000 Welcome to the product gallery walk through. 2 00:00:13,000 --> 00:00:23,000 Adding a product: Select image. 3 00:00:23,000 --> 00:00:32,000 Insert title and description.
Next I needed to turn those “soft” subs into “hard” ones. This is where mplayer/mencoder come in. To add soft subs to a video in mplayer, you use the -sub option. Running this in mplayer first is a good way to see how it will look at tweak it according to the many options you have. I went with the defaults, it looks pretty good that way.
Lastly, I needed a good mencoder recipe to pull it all together. After lots of searching I found a great MPEG4 one here.
It’s a two pass system, and the crucial piece is in calculating the bitrate:
bitrate = 50 * 25 * width_of_video * height_of_video / 256
My bitrate was 2540600. After you get that, you just plug it into the two passes below. This includes my subtitle options.
mencoder -o /dev/null -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=1:vbitrate=2540600:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2:mv0:last_pred=3 -nosound -sub MySubTitles.srt -subfont-text-scale 3 RawScreenCast.avi mencoder -o FinishedScreenCast.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=2:vbitrate=2540600:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2:mv0:last_pred=3 -nosound -sub MySubTitles.srt -subfont-text-scale 3 RawScreenCast.avi
It takes a while but not too long. When all was said and done I had a perfect hard-subbed version and it shrank my file size from ~550MB to 7.6MB. That is a great encoding recipe.

An average frame, with hard subs.
I spend a lot of time on the command line, and one thing I run up against every once in a while is doing math. I normally jump through the bc hoops, but today this bit came through my feed reader.
calc(){ awk "BEGIN{ print $* }" ;}
Just drop it into your .bashrc, .alias, or whatever else you use.
jmhobbs@asuka:~$ calc 9*100+14/10 901.4 jmhobbs@asuka:~$
Great solution using existing tools, props to TinyHacker.com for this one.
Posted November 3rd, 2009 - Permalink