Skip to content

Instantly share code, notes, and snippets.

@yannick
Last active January 24, 2017 12:51
Show Gist options
  • Select an option

  • Save yannick/add7089309b167bf08c47522af6ac7bb to your computer and use it in GitHub Desktop.

Select an option

Save yannick/add7089309b167bf08c47522af6ac7bb to your computer and use it in GitHub Desktop.
well, here is a hint: make it simple but significant
intervall = 60
unique_ids = {}
last_flush = 0
for msg in stream:
unique_ids[msg["uid"]] = True #KISS
if (msg["ts"] - intervall > last_flush):
uniques = len( unique_ids.keys()) #ouch... but works
print( "\t".join( ( msg["ts"], uniques ) ))
last_flush = msg["ts"]
unique_ids = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment