salvar textos digitados como gists do Github

Converta /usr/bin/scriptarquivos automaticamente no Github. Útil para gravar sessões de instalação.

function scripto() {
# Sane API token?
curl
-Insw "%{http_code}" https://api.github.com/user | tail -1 | grep -q 200 || (echo "Can't reach API" && return 1)

# Instance a gist and clone it
GISTID
=$(curl -nksd '{"files":{"sfile":{"content":"scriptfile in-flight"}}}' https://api.github.com/gists | awk -F""" '$2 == ""id"" {print $4}' | head -1);
git clone
-q ""https://gist.github.com/""$GISTID"".git"" ~/$GISTID &>/dev/null;

# API and gist can use the same token but use different addresses