Skip to content

Instantly share code, notes, and snippets.

@abachman
Created September 7, 2021 13:32
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 abachman/5b26466250ea89d69cb0ea8318dd42b0 to your computer and use it in GitHub Desktop.
Save abachman/5b26466250ea89d69cb0ea8318dd42b0 to your computer and use it in GitHub Desktop.
passphrase generator
#!/usr/bin/env ruby
# ws=open('/usr/share/dict/words').readlines.map(&:strip).select{|w|/^[a-z]{7}$/=~w};100.times{p ws.sample(6).join(' ')}
ws=open('/usr/share/dict/words').readlines.select {|w|
/^[a-z]{5,7}\b/ =~ w
}.map(&:strip)
def n
(rand() * 89 + 10).floor.to_s
end
CHARS = '!@#$%^&*(){}[]-_=+;:?/.,<>|'.chars
def s
CHARS.sample
end
100.times {
puts ws.sample(6).map {|w| w + n + s}.join()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment