brew install gist
cat gistlist.sh
#!/bin/bash
# single url execution
# curl -u karlarao:<put_token_here> --url https://api.github.com/gists/<gist_id> | egrep "created_at|updated_at|filename|\"html_url\"\: \"https\:\/\/gist" | grep -v content | grep -v " \"html_url\"" | grep -v " \"updated_at\"" | grep -v " \"created_at\"" | egrep -A1 "html_url|updated|created" | grep -v "\-\-" | sed 'N;N;N;s/\n//g' | awk -F'"' '{print substr($12,1,10)"|"substr($16,1,10)"|"$4"|"$8}'
# loop through all gist id
gist -l | awk -F" " '{print $1}' | awk -F'/' '{print $4}' > gist.txt
rm gistdata.txt
for i in `cat gist.txt`; do
curl -u karlarao:<put_token_here> --url https://api.github.com/gists/$i >> gistdata.txt
done
cat gistdata.txt | egrep "created_at|updated_at|filename|\"html_url\"\: \"https\:\/\/gist" | grep -v content | grep -v " \"html_url\"" | grep -v " \"updated_at\"" | grep -v " \"created_at\"" | egrep -A1 "html_url|updated|created" | grep -v "\-\-" | sed 'N;N;N;s/\n//g' | awk -F'"' '{print substr($12,1,10)"|"substr($16,1,10)"|"$4"|"$8}' | sort -rnk1 > gistfinal.txt
cat gistfinal.txt
# add diff
printf "%-10s|%-10s|%-3s|%-56s|%s\n" "Created" "Modified" "Dif" "URL" "Name" > gistlist.txt;cat gistfinal.txt | while IFS="|" read d1 d2 url1 file1 ; do typeset -i ddif;d1s=`date -j -f'%Y-%m-%d' "$d1" +'%s'`;d2s=`date -j -f'%Y-%m-%d' "$d2" +'%s'`;ddif=($d2s-$d1s)/86400;printf "%s|%s|%3d|%s|%s\n" $d1 $d2 $ddif "$url1" "$file1"; done >> gistlist.txt
cat gistfinal.txt
2018-08-17|2018-08-17|https://gist.github.com/<gist_id>|private.md
2018-08-16|2018-08-16|https://gist.github.com/<gist_id>|toc.md
2018-08-15|2018-08-16|https://gist.github.com/<gist_id>|get memory from sqlmon files, get high memory SQL.md
2018-08-14|2018-08-16|https://gist.github.com/<gist_id>|gluentwiki.md
2018-08-14|2018-08-14|https://gist.github.com/<gist_id>|gluent_present.md
2018-08-14|2018-08-14|https://gist.github.com/<gist_id>|gluent_offload.md
2018-08-14|2018-08-14|https://gist.github.com/<gist_id>|todo.md
...
2016-09-01|2016-09-01|https://gist.github.com/<gist_id>|storage.R
2016-08-30|2016-08-30|https://gist.github.com/<gist_id>|week4_final_karao
2016-08-17|2016-08-17|https://gist.github.com/<gist_id>|week2_q3_karao
# gist output
gist -l | wc -l
75
# gistlist.sh output
wc -l gistfinal.txt
75 gistfinal.txt
cat gistlist.txt
Created |Modified |Dif|URL |Name
2018-08-17|2018-08-17| 0|https://gist.github.com/<gist_id>|private.md
2018-08-16|2018-08-16| 0|https://gist.github.com/<gist_id>|toc.md
2018-08-15|2018-08-16| 1|https://gist.github.com/<gist_id>|get memory from sqlmon files, get high memory SQL.md
2018-08-14|2018-08-16| 2|https://gist.github.com/<gist_id>|gluentwiki.md