Skip to content

Instantly share code, notes, and snippets.

@michenriksen
Last active February 24, 2021 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michenriksen/7430125 to your computer and use it in GitHub Desktop.
Save michenriksen/7430125 to your computer and use it in GitHub Desktop.
Simple function to view the source code of a web page in a terminal with syntax highlighting. Very convenient for checking out potentially malicious websites before rendering them in a browser. [Pygments](http://pygments.org/) is used for the syntax highlighting and can be installed with `sudo easy_install pygments`. Copy/Paste the function into…
function viewsource {
/usr/bin/curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0" -s "$1" | /usr/local/bin/pygmentize -g -O encoding='utf-8'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment