annotate bin/pwgen @ 606:b9672858e2e2

Better color
author nanaya <me@nanaya.pro>
date Tue, 20 Jun 2017 01:25:03 +0900
parents fea77cdcdb09
children bdc9eddf3743
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env ruby
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
2
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
3 require 'securerandom'
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
4
495
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
5 length = ARGV[0].to_i
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
6 length = 12 if length <= 0
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
7 5.times do |n|
495
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
8 puts "#{n}: #{SecureRandom.urlsafe_base64(length).slice(0, length)}"
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
9 end