Register now and start sharing your code snippets.
How to generate a pronouncable password with PHP
PHP posted 6 months ago by christian
This is a slight modification of a script I found at PHPFAQ :
1 class Password 2 { 3 static function generate($length) 4 { 5 srand((double)microtime()*1000000); 6 7 $vowels = array("a", "e", "i", "o", "u"); 8 $cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", 9 "cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl"); 10 11 $num_vowels = count($vowels); 12 $num_cons = count($cons); 13 14 $password = ''; 15 16 for($i = 0; $i < $length; $i++) 17 { 18 $password .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)]; 19 } 20 21 return substr($password, 0, $length); 22 } 23 }
To use it try this code:
1 require 'password.php' 2 3 echo Password.generate(10);
It will spit out passwords that are semi-pronouncable.
SSH public key encryption - How to generate the key and how to copy it to the remote machine
Shell Script (Bash) posted 7 months ago by christian
1 ssh-keygen -t dsa 2 ssh-copy-id -i ~/.ssh/id_dsa.pub user@server
OS X doesn’t come equipped with ssh-copy-id but you can download the script from here.