Skip to content

Instantly share code, notes, and snippets.

@eric-wood
Created March 29, 2016 01:28
Show Gist options
  • Save eric-wood/021b50e4a89ecf22d058 to your computer and use it in GitHub Desktop.
Save eric-wood/021b50e4a89ecf22d058 to your computer and use it in GitHub Desktop.
data = File.read(ARGV[0])
def bits(byte, offset, size: 2)
bitmask = (2 ** size - 1) << offset
(byte & bitmask) >> offset
end
def ascii(data)
data.gsub(/\u0000/, ' ')
end
program = {
header: data[0..7],
name: ascii(data[12..22]).rstrip # NOTE: last char of name is always "@" so strip it off
}
p program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment