SHARE
TWEET

Untitled

a guest Mar 4th, 2011 161 Never
  1. import sys
  2.  
  3. try:
  4.     counter = {}
  5.  
  6.     for bytes in open(sys.argv[1], "rb").read():
  7.         try:
  8.             counter[bytes] += 1
  9.         except KeyError:
  10.             counter[bytes] = 1
  11.  
  12.     peak = max(counter.values())
  13.  
  14.     for key in sorted(counter.keys()):
  15.         print '%02x: %08d %s' % (ord(key), counter[key], '-' * (66 * counter[key]/peak))
  16.  
  17. except Exception, e:
  18.     print e
RAW Paste Data
Top