I adapted the script a bit:
https://gist.github.com/sebastianbergmann/8684716