Created
March 29, 2016 01:28
-
-
Save eric-wood/021b50e4a89ecf22d058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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