Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stream = File.new(ARGV.shift) rescue abort("Where's the file?")
- patterns = Array.new(256, 0)
- buffer = String.new
- size = stream.size
- blksize = stream.stat.blksize*256
- while stream.read(blksize, buffer)
- buffer.bytes do |byte|
- patterns[byte] += 1
- end
- end
- patterns.each.with_index do |x, index|
- puts("#" * (x.to_i.fdiv(size)*10000))
- end
- #patterns.each.with_index do |x, index|
- #char = (index < 127 and index > 31 and index or 32).chr
- #puts "%03d %s %02d %f" % [index, char, x.to_i, x.to_i.fdiv(size)]
- #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement