Factor out gist-related code to a separate script.