For those concerned about a SQL dependency, it might be useful to create projects in different languages that package these functions. These methods were extracted from https://github.com/ankane/groupdate, which you can use for Ruby + ActiveRecord
It's an https request to GitHub, which has about a million more subtle ways to own your machine if they really wanted to.
Figuring out how to solve the TOCTOU problem for a small script in a source control repo is should not be difficult for anyone actually qualified to tell if a script is evil or not by looking at it.