Skip to content

Instantly share code, notes, and snippets.

@sentientmonkey
Created January 22, 2017 02:35
Show Gist options
  • Save sentientmonkey/4e6468cb7b5c43fe300bba4d4aacb072 to your computer and use it in GitHub Desktop.
Save sentientmonkey/4e6468cb7b5c43fe300bba4d4aacb072 to your computer and use it in GitHub Desktop.
require "zlib"
data = "the quick brown fox jumps over the lazy dog\n"
compressed_data = Zlib::Deflate.deflate data
File.write("saved_compressed_data", compressed_data)
read_compressed_data = File.read("saved_compressed_data")
a,b = read_compressed_data.bytes[0..1]
puts "%02x %02x" % [a, b]
puts "Compressed" if 0x78 == a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment