Support emails in github.user and fix permission exception on getting gists.

* Fetch a correct username: fix requests with wrong username if the github.user value is an e-mail.
* Save gist to a tempfile instead of creating a new file in the root path, which may cause permission exception.