Skip to content

Instantly share code, notes, and snippets.

@phette23
Created April 3, 2015 22:05
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 phette23/0f0ec3c52dbcda342d06 to your computer and use it in GitHub Desktop.
Save phette23/0f0ec3c52dbcda342d06 to your computer and use it in GitHub Desktop.
Simple Node Random Password Script
#!/usr/bin/env node
// usage:
// > randpw
// IKS1L2H1AMOx
// > randpw --length 22
// IKS1L2H1AMOxBs4d8qxDXY
// > randpw | pbcopy # pipe to Mac clipboard
var chance = new require('chance')()
var args = require('minimist')(process.argv.slice(2))
var pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
var pw = chance.string({
pool: pool,
length: args.l || args.length || 12
})
process.stdout.write(pw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment