Skip to content

Instantly share code, notes, and snippets.

@ueokande
Created May 18, 2017 03:25
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 ueokande/c11818bcf8868bcde4096d9cf0de4fec to your computer and use it in GitHub Desktop.
Save ueokande/c11818bcf8868bcde4096d9cf0de4fec to your computer and use it in GitHub Desktop.
Print rowkey
#!/usr/bin/env ruby
utsname = []
topic = []
if ARGV.length < 1
STDERR.puts("Missing arguments")
exit 1
end
file = File.open(ARGV[0], "r")
file.each_byte do |byte|
if byte == 0
break
end
topic << byte
end
file.each_byte do |byte|
if byte == 0
break
end
utsname << byte
end
# timestamp = file.read(8).unpack("N")
timestamp = file.read(8).reverse.unpack("q").first
id = file.read(8).reverse.unpack("q").first
puts "topic = #{topic.pack('c*')}"
puts "utsname = #{utsname.pack('c*')}"
puts "timestamp = #{Time.at(timestamp)}"
puts "id = #{id}"
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment