Swiss Army Knife
Message from 2022
This post is pretty old! Opinions and technical information in it are almost certainly oudated. Commands and configurations will probably not work. Consider the age of the content before putting any of it into practice.
Short post because it’s late and I’m tired, but Ruby’s pretty damn useful if you have boring tasks you want to automate:
#!/usr/bin/env ruby
f = File.new(ARGV[0], 'r').read
f.each_byte do |b|
$stdout.write('0x'+b.to_s(16)+', ')
end
in case you ever wanted to take your big binary file and inline it as a C array.