Skip to content

Instantly share code, notes, and snippets.

@javierwilson
Created February 12, 2013 20:00
Show Gist options
  • Save javierwilson/4772885 to your computer and use it in GitHub Desktop.
Save javierwilson/4772885 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os, os.path
import fileinput
files_in_dir = os.listdir('.')
for f in files_in_dir:
for line in fileinput.input(f, inplace=1):
#for line in fileinput.input(f):
if line == '<head>\n':
print '%s<script language="javascript">if(self.location==top.location)self.location="index.html?%s";</script>' % (line, f)
else:
print line,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment