Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 4th, 2011  |  syntax: Python  |  size: 0.39 KB  |  views: 160  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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
clone this paste RAW Paste Data