Skip to content

Instantly share code, notes, and snippets.

@4np
Last active October 12, 2015 20:18
Show Gist options
  • Save 4np/4082169 to your computer and use it in GitHub Desktop.
Save 4np/4082169 to your computer and use it in GitHub Desktop.
List your personal top 5 GitHub new items
# Commands to retrieve the top 5 personal news items from GitHub. Can easily be used with GeekTools:
# top 5 news items
GITHUB_USER="...";GITHUB_TOKEN="...";curl --silent "https://github.com/$GITHUB_USER.private.atom?token=$GITHUB_TOKEN"|grep -E '(title type="html">|published>)'|sed -e 's/<title type="html">//' -e 's/<\/title>//' -e 's/<published>//' -e 's/<\/published>/ DATE /' -e 's/ //' -e 's/\([0-9]*\)-\([0-9]*\)-\([0-9]*\)/\3-\2/' -e 's/T\([0-9]*\):\([0-9]*\):\([0-9]*\)Z/ \1:\2/'|awk 'gsub(/DATE $/,""){printf $0;next;}1'|head -n 5
# same as above but now separated into three commands for formatting purposes:
# 1. top 5 news date times:
GITHUB_USER="...";GITHUB_TOKEN="...";curl --silent "https://github.com/$GITHUB_USER.private.atom?token=$GITHUB_TOKEN"|grep -E '(published>)'|sed -e 's/<published>//' -e 's/<\/published>//' -e 's/\([0-9]*\)-\([0-9]*\)-\([0-9]*\)/\3-\2/' -e 's/T\([0-9]*\):\([0-9]*\):\([0-9]*\)Z/ \1:\2/'|head -n 5
# 2. top 5 new users:
GITHUB_USER="...";GITHUB_TOKEN="...";curl --silent "https://github.com/$GITHUB_USER.private.atom?token=$GITHUB_TOKEN"|grep -E '(<name>)'|sed -e 's/<name>//' -e 's/<\/name>//' -e 's/\([ ]*\)//'|head -n 5
# 3. top 5 news entries:
GITHUB_USER="...";GITHUB_TOKEN="...";curl --silent "https://github.com/$GITHUB_USER.private.atom?token=$GITHUB_TOKEN"|grep -E '(title type="html">)'|sed -e 's/<title type="html">//' -e 's/<\/title>//' -e 's/ //' -e 's/\([A-Za-z0-9]*\) //'|head -n 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment