cloudservice/api/v1/atmo-init.20110111.rb
def makePasswd(n)
  passwd = ""
  lower_chars = ("a".."z").to_a
  upper_chars = ("A".."Z").to_a
  numbers = ("0".."9").to_a
  special_chars = ["~","!","@","#","$","%","^","*"]
  passwd_chars = (lower_chars + upper_chars + numbers + special_chars).uniq
  passwd_chars_size = passwd_chars.size
  passwd = Array.new(n){ passwd_chars[rand(passwd_chars_size)] }.join
  return passwd
end
# makePasswd function can be simply done by "openssl rand -base64 8"
makePasswd function can be simply done by "openssl rand -base64 8"
makePasswd function can be simply done by " openssl rand - base64 8 "
def makePasswd(n)
  passwd = ""
  lower_chars = ("a".."z").to_a
  upper_chars = ("A".."Z").to_a
  numbers = ("0".."9").to_a
  special_chars = ["~","!","@","#","$","%","^","*"]
  passwd_chars = (lower_chars + upper_chars + numbers + special_chars).uniq
  passwd_chars_size = passwd_chars.size
  passwd = Array.new(n){ passwd_chars[rand(passwd_chars_size)] }.join
  return passwd
end
def makePasswd ( n ) passwd = "" lower_chars = ( "a" .. "z" ) . to_a upper_chars = ( "A" .. "Z" ) . to_a numbers = ( "0" .. "9" ) . to_a special_chars = [ "~" , "!" , "@" , "#" , "$" , "%" , "^" , "*" ] passwd_chars = ( lower_chars + upper_chars + numbers + special_chars ) . uniq passwd_chars_size = passwd_chars . size passwd = Array . new ( n ) { passwd_chars [ rand ( passwd_chars_size ) ] } . join return passwd end
makePasswd function can be simply done by "openssl rand -base64 8"
makePasswd function can be simply done by " openssl rand - base64 8 "
n