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
| def range_query(self, window): | |
| exploration = [self.root] | |
| total = 0 | |
| while len(exploration) > 0: | |
| node = exploration.pop() | |
| bucket = node.bucket | |
| overlap = intersect(window, bucket) | |
| if overlap == 0: | |
| continue |
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
| Epoch 0, loss: 2470732890112.0, minskew: 324712223.5895718 (-30.12%) | |
| Epoch 1, loss: 4976891396096.0, minskew: 322867038.3427776 (-29.720000000000002%) | |
| Epoch 2, loss: 1988469456896.0, minskew: 308832965.8504016 (-26.529999999999998%) | |
| Epoch 3, loss: 1074910593024.0, minskew: 299019601.6535032 (-24.11%) | |
| Epoch 4, loss: 1326247051264.0, minskew: 314994474.41293186 (-27.96%) | |
| Epoch 5, loss: 1089749975040.0, minskew: 300969136.836088 (-24.610000000000003%) | |
| Epoch 6, loss: 1215434326016.0, minskew: 304905721.3075693 (-25.580000000000002%) | |
| Epoch 7, loss: 1900931579904.0, minskew: 333435513.5869637 (-31.95%) | |
| Epoch 8, loss: 591333097472.0, minskew: 294894544.03124714 (-23.05%) | |
| Epoch 9, loss: 1692569305088.0, minskew: 307144998.11245894 (-26.119999999999997%) |
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
| import datetime | |
| import requests | |
| import csv | |
| import time | |
| base_url = "https://api.pushshift.io/reddit/search/submission/?subreddit={subreddit}&sort=asc&sort_type=created_utc&after={after}&size=1000&before={before}" | |
| now = datetime.datetime.now() | |
| now_stamp = datetime.datetime.strftime(now, "%s") | |
| # UTC 2018/01/01 0:0:0 |
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
| // Based on http://cgbystrom.com/articles/deconstructing-spotifys-builtin-http-server/ | |
| var request = require('request'); | |
| var spotify = function(){ | |
| this.port = 4371; | |
| this.nowPlaying = {}; | |
| this.getOauth(); | |
| } | |
| spotify.prototype.getOauth = function() { |