public
Last active

  • Download Gist
passphrase.rb
Ruby
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
words = {}.tap{|h| h.default = 0}
corpus = %x[ls].split.select{|n| n =~ /\.txt/}
.map{|f| File.read(f)}.reduce(&:+).split
.map{|w| w.downcase.gsub(/[^a-z]/,'')}
corpus.each{|w| words[w] += 1}
ranked_words = words.select{|k,_| k.length > 3}.sort_by{|_,v| -v}[0..5000]
10.times do
puts ranked_words.sample(4).map(&:first).map(&:capitalize).join
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.