Skip to content

Instantly share code, notes, and snippets.

@andyjeffries
Created January 24, 2014 11:35
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 andyjeffries/8595802 to your computer and use it in GitHub Desktop.
Save andyjeffries/8595802 to your computer and use it in GitHub Desktop.
Full HTML page (with asset) hashing
#!/usr/bin/env ruby
require 'tmpdir'
require 'digest/sha1'
hash = ""
Dir.mktmpdir do |dir|
`cd #{dir} && wget -E -H -k -K -q -p #{ARGV[0]}`
Dir["#{dir}/**/*"].each do |filename|
unless File.directory?(filename)
# puts filename
hash = Digest::SHA1.hexdigest(hash + File.read(filename))
end
end
end
puts hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment