Skip to content

Instantly share code, notes, and snippets.

@mbierman
Created July 26, 2016 23:33
Show Gist options
  • Select an option

  • Save mbierman/b4d8b74d3028817f9a0190fa5a683619 to your computer and use it in GitHub Desktop.

Select an option

Save mbierman/b4d8b74d3028817f9a0190fa5a683619 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Use two URLS from the "View" link on the verions page of a GIST
USER=mbierman
PASS=
if [[ ! -z $USER && ! -z $PASS && ! -z $1 && ! -z $2 ]]; then
ID1=$(echo $1 | cut -d "/" -f5)
SHA1=$(echo $1 | cut -d "/" -f6)
raw1=$(curl -u $USER:$PASS https://api.github.com/gists/$ID1/$SHA1 | grep raw_url | cut -d '"' -f4)
ID2=$(echo $2 | cut -d "/" -f5)
SHA2=$(echo $2 | cut -d "/" -f6)
raw2=$(curl -u $USER:$PASS https://api.github.com/gists/$ID2/$SHA2 | grep raw_url | cut -d '"' -f4)
curl -u $USER:$PASS $raw1 > /tmp/F1
curl -u $USER:$PASS $raw2 > /tmp/F2
diff --suppress-common-lines /tmp/F1 /tmp/F2
else
echo -e "\n\n Define github username, password, and provide two revisions of a gist to be verified eg.
`basename $0` file1 file2"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment