Add versioning script

Lifted yet another copy of @spmason's versioning script