Skip to content

Instantly share code, notes, and snippets.

@privong
Created October 26, 2014 14:05
Show Gist options
  • Save privong/cefcacd42a4bbd28dfe3 to your computer and use it in GitHub Desktop.
Save privong/cefcacd42a4bbd28dfe3 to your computer and use it in GitHub Desktop.
daily website loading
#!/usr/bin/env python2
#
# Script to load a list of websites into firefox.
#
# Loads config file in: ~/.mozilla/daily_websites
# Format is:
# URL ------- (where the dashes are replaced by 1 or 0 if the page is to be
# loaded on that day of the week, [starting with Monday])
# Example, if you want to only load slashdot.org on Mon, Wed, Fri:
# http://slashdot.org 1010100
import os
from datetime import datetime
home = os.environ['HOME']
today = datetime.now()
day = today.isoweekday()
pages = ''
if (os.path.isfile(home+'/.mozilla/daily_websites')):
webfile = open(home+'/.mozilla/daily_websites', 'r')
for line in webfile:
[page, dates] = line.split()
if int(dates[day-1]):
pages = pages + ' ' + page
os.system('firefox ' + pages + ' &')
else:
print "Error: " + home + "/.mozilla/daily_websites not located."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment