Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mathieu-lacage/ac8d6d2d380b564f9f475d854ec332a9 to your computer and use it in GitHub Desktop.
Save mathieu-lacage/ac8d6d2d380b564f9f475d854ec332a9 to your computer and use it in GitHub Desktop.
import json
import time
import sys
import unicodedata
import re
import gc
CHARACTER_WHITESPACE = '\u2581'
class MyHooks(object):
done = False
def on_gc_minor(self, stats):
pass
def on_gc_collect_step(self, stats):
pass
def on_gc_collect(self, stats):
print(gc.get_stats(True))
hooks = MyHooks()
gc.hooks.set(hooks)
def read(filename):
with open(filename) as f:
for line in f:
yield json.loads(line)
def main():
time.sleep(2)
l = read(sys.argv[1])
l = [CHARACTER_WHITESPACE + re.sub('\s+', CHARACTER_WHITESPACE, i) for i in l]
time.sleep(5)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment