This evolved into something greater then a single bash file, so I loved it to its own repo over at GitHub.

You'll find an up to date version here.