Skip to content

Instantly share code, notes, and snippets.

@shirts
Created April 17, 2016 19:47
Show Gist options
  • Save shirts/a0eaa0569706dc7c03e7fef4d62f7986 to your computer and use it in GitHub Desktop.
Save shirts/a0eaa0569706dc7c03e7fef4d62f7986 to your computer and use it in GitHub Desktop.
Ruby Combination Generator
# uses gem combination_generator
# generates all possible 8 character combinations for letters A-Z
# writes combinations to file combinations.txt
require 'combination_generator'
alphabet = ('a'..'z').to_a.map(&:upcase!)
combinations = []
CombinationGenerator.new(8, alphabet).each {|combo| combinations << combo }
f = File.new 'combinations.txt', 'w'
f.write(combinations)
f.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment