Created
May 18, 2017 03:25
-
-
Save ueokande/c11818bcf8868bcde4096d9cf0de4fec to your computer and use it in GitHub Desktop.
Print rowkey
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
#!/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