Check SHA or MD5 sums on Windows

I know I should do this more often on my own machine, but I am weak. However, it is a necessity when installing Open Source software at work that I check the checksums after download. I always forget how to do it and often laboriously check the whole thing with MK 1 human eyeball. Dumb.

So, to make it better, here’s the simple, command line way, to check the checksums.

You’ll need:

  1. cygwin installed
  2. cd’ed to the folder where you downloaded the installation file to.

echo "9819c6d21360f805cc17157c64c24672 apache-tomcat-7.0.42.exe" | sha1sum -c -

If it’s good you should get (depending on your gitbash/bash/etc shell you’re using):

apache-tomcat-7.0.42.exe: OK

If bad you get: 

apache-tomcat-7.0.42.exe: FAILED
md5sum: WARNING: 1 computed checksum did NOT match

or maybe

no properly formatted MD5 checksum lines found

Thanks to Les on upthescala

EDIT 20130816: Fixed typo in command to remove pipe and replace with redirect.
EDIT 20140128: What was I thinking on previous edit? Anyway, fixed and added a little more colour.


OSX: Create a Playlist From a Folder

I wanted to use this excellent command line from on the mac to create a podcasts playlist on my G1 each time I chucked some new podcast files on it. Unfortunately OSX (or BSD) aren’t exact matches to linux, so here’s my hack. It’s not elegant, too many pipes, but it works!

cd /Volumes/NIALLSG1/Music/Podcasts && find . -type f -exec stat -f "%c %N" {} \; | grep -v '\./\._' | grep -v m4v | sort -rn | sed 's/\.\//;.\//' | awk -F ';' '{print $2}' > ../podcasts.m3u

On my mounted G1 all my podcasts live in /Volumes/NIALLSG1/Music/Podcasts. I generate the podcasts.m3u to the Music folder.

The stat prints the created date as seconds from the epoch followed by the file name.

The first grep -v removes the stupid itunes symbolic links (mutter, mutter) that get copied across from the listings in iTunes, the second removes video podcasts as the Music Player doesn’t play the video.

The sort gives us the list sorted on created date descending.

The sed gives me an easy delimiter to use in the awk. A cheaty bit I know.

The awk spews out the filenames only for the write to the m3u file.

Teh usual caveats apply; your mileage may vary; be careful; etc.

Weather Check

If you have a linux OS the bash shell script below will tell you most recent temp, windspeed, direction, and rainfall at Everton, Sandy, and Biggleswade from local weather stations using weatherunderground. I crontab it, piping the results to mail -s ‘Current weather’


function checkComponent() {

       curl -s $aurl | tail -3 | tr '\n' ',' | awk -F, ' { print "NAME@ " (5/9)*($2-32) "C dp " (5/9)*($3-32) "C " $5 "@" $8 "mph " $92 "CurrentRain " $10 "in DailyRain " $13 "in\n" } ' | sed "s:NAME:${name}:" >> tempweather

checkComponent IENGLAND82 Everton
checkComponent IBEDSBIG1 Biggles
checkComponent I90580822 Sandy

cat tempweather
rm tempweather