Skip to content

Instantly share code, notes, and snippets.

@cat5inthecradle
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save cat5inthecradle/f4dbed9f37b80e024265 to your computer and use it in GitHub Desktop.

Select an option

Save cat5inthecradle/f4dbed9f37b80e024265 to your computer and use it in GitHub Desktop.
Python Firefox Tab Counter
import json
import os
import glob
from datetime import datetime
appdata = os.getenv('APPDATA')
fi = open(glob.glob(appdata + '/Mozilla/Firefox/Profiles/*.default/sessionstore-backups/recovery.js')[0], "r")
jdata = json.loads(fi.read())
fi.close()
fo = open('tabcount.csv', 'a')
fo.write(str(datetime.now()) + ", " + str(jdata["windows"][0]["selected"]))
fo.write("\n")
fo.close()
@cat5inthecradle
Copy link
Author

Running this as a scheduled task every hour for funzies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment