Skip to content

Instantly share code, notes, and snippets.

@ianbishop
Created January 23, 2014 03:07
Show Gist options
  • Save ianbishop/8572166 to your computer and use it in GitHub Desktop.
Save ianbishop/8572166 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rugged'
include Rugged
repo = Repository.new("/home/ian/open-source/stripe/level1/level1")
difficulty = "001"# `cat difficulty.txt`
index = repo.index
options = {}
options[:tree] = index.write_tree(repo)
options[:author] = { :email => "bishop14@gmail.com", :name => "Ian Bishop", :time => Time.now }
options[:committer] = options[:author]
options[:parents] = [ repo.head.target ].compact
options[:update_ref] = 'HEAD'
options[:message] = "Give me Gitcoin!"
sha1 = Commit.create(repo, options)
until sha1 < difficulty
counter = Random.rand(100000000000000000)
sha1 = Commit.create(repo, options.merge({:message => "Give me a Gitcoin! #{counter}", :update_ref => "master/#{sha1}"}))
end
puts "FOUND! #{sha1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment