Skip to content

Instantly share code, notes, and snippets.

@m4p
Created April 22, 2013 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4p/5435295 to your computer and use it in GitHub Desktop.
Save m4p/5435295 to your computer and use it in GitHub Desktop.
shutup.py
#!/usr/bin/python
import cgi
import urllib2
import re
import cgi
fs = cgi.FieldStorage()
url = fs['url'].value
print "Content-type: text/html"
print ""
usock = urllib2.urlopen(url)
data = usock.read()
usock.close()
print re.sub('(<head.*?>)',r'\1 <base href="'+url+'" /><link rel="stylesheet" href="http://stevenf.com/shutup/shutup-latest.css" />', data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment