a clone from https://gist.github.com/6005442.git