https://gist.github.com/kaspermeerts/781f0137b361b51224dcab7...
https://gist.github.com/kaspermeerts/b6f158b1278de307e48a200...
Haven't looked at it in five years, but it should probably still work if you update the variables at the top.