Skip to content

Instantly share code, notes, and snippets.

@pczajkowski
Created May 22, 2015 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pczajkowski/9b498195b529798c17b0 to your computer and use it in GitHub Desktop.
Save pczajkowski/9b498195b529798c17b0 to your computer and use it in GitHub Desktop.
#get time
MYTIME=$(date)
#get IPs
IP=$(/sbin/ip -o -4 addr list | awk '{print $2 ": ", $4}')
#remove linebreak
IPF=$(echo $IP)
#json content
post='{"public":false,"files":{"IP.txt":{"content":"'$MYTIME' : '${IPF}'"}}}'
#create a command
crl="curl --header 'Authorization: bearer YOUR_TOKEN_HERE' --header 'Accept: application/json' --header 'Content-type: application/json' --request POST --data '${post}' https://api.github.com/gists"
echo $crl | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment