Skip to content

Instantly share code, notes, and snippets.

@ssvb
Created May 3, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssvb/bfa10a8846bf78c46b9049f2a164e3a2 to your computer and use it in GitHub Desktop.
Save ssvb/bfa10a8846bf78c46b9049f2a164e3a2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
data = []
File.open(ARGV[0]).each_byte {|b| data.push(b) }
(0..(data.size - 1)).step(4) {|i|
x0 = data[i + 0]
x1 = data[i + 1]
x2 = data[i + 2]
x3 = data[i + 3]
STDOUT.write([x3, x2, x1, x0].pack('c*'))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment