Skip to content

Instantly share code, notes, and snippets.

@cgwalters
Created January 20, 2015 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgwalters/fc7a120e77ae4f8682a3 to your computer and use it in GitHub Desktop.
Save cgwalters/fc7a120e77ae4f8682a3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys,math
buckets = {}
for f in open(sys.argv[1]).readlines():
f.strip()
s,p = f.split(' ', 1)
sz = int(s)
sz_mb = sz / (1024*1024)
[n,s] = buckets.get(sz_mb, [0,0])
buckets[sz_mb] = (n+1, s+sz)
for v in sorted(buckets.keys()):
[n,s] = buckets[v]
print "%s => %s (%s MB)" % (v, n, s/(1024*1024))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment