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
#/bin/bash | |
# Fix all the files and puts them in a 'fixed' subdirectory | |
mkdir fixed | |
for f in *.gz; do gunzip -c $f | ruby jsonsm.rb | gzip -c > fixed/$f; done |
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 collections | |
import time | |
import requests | |
import pymongo | |
import ratelim | |
import textwrap | |
G_GEO_SUCCESS = 200 | |
G_GEO_SERVER_ERROR = 500 | |
G_GEO_MISSING_QUERY = 601 |
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
# FILL FILENAME | |
# Return the seconds from last modification of a file, among a list of files | |
file=$(ls FILENAME -hant --time-style +%s | head -n1 | awk '{print $6}' ) ; now=$(date +%s); echo $((now-file)) |
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 time | |
import datetime | |
class rate_limited(object): | |
def __init__(self, max_calls, time_interval): | |
assert max_calls > 0 | |
assert time_interval > 0 | |
self.__last_reset = None | |
self.__max_calls = max_calls | |
self.__time_interval = time_interval # seconds |
NewerOlder