Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianloveswords/661e2cac17421337a497 to your computer and use it in GitHub Desktop.
Save brianloveswords/661e2cac17421337a497 to your computer and use it in GitHub Desktop.
$(cd /tmp && curl -H "Host: brooklynjs.com" 23.235.39.133 > brooklynjs.html && $(command -v open > /dev/null && which open || which xdg-open) brooklynjs.html && sleep 3 && rm brooklynjs.html)

What is happening here

Everything happens in a subshell so it shouldn't affect your shell stuff.

  • changes directory to "/tmp"
  • curls the github pages IP address with the proper Host header set so it knows to serve the brooklynjs.com page
  • pipes the output to a file, "brooklynjs.html"
  • figures out whether to use open or xdg-open to open the file
  • uses the result of above to open the file
  • sleeps 3 seconds becauses open doesn't block, then deletes the file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment