Last active
January 24, 2017 12:51
-
-
Save yannick/add7089309b167bf08c47522af6ac7bb to your computer and use it in GitHub Desktop.
well, here is a hint: make it simple but significant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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