Skip to content

Instantly share code, notes, and snippets.

@sente
Created August 16, 2013 22:13
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 sente/6253933 to your computer and use it in GitHub Desktop.
Save sente/6253933 to your computer and use it in GitHub Desktop.
from events import events
import pprint
import operator
import collections
import datetime
secs = 24*60*60*15
now = int(datetime.datetime.now().strftime("%s"))
first_epoch = now - secs
last_15 = list(events.find({'epochtime': {'$gt': first_epoch}}))
lists = [frozenset(l.keys()) for l in last_15]
most_common = collections.Counter(lists)
sorted_x = sorted(most_common.iteritems(), key=operator.itemgetter(1))
for num, ourset in sorted_x:
print num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment