Skip to content

Instantly share code, notes, and snippets.

@matthieuprat
Last active August 29, 2015 14:23
Show Gist options
  • Save matthieuprat/28a03fffb51d16ff8015 to your computer and use it in GitHub Desktop.
Save matthieuprat/28a03fffb51d16ff8015 to your computer and use it in GitHub Desktop.
Generate a random token (in a fucked-up way)
Array.apply(null, Array(parseInt(process.argv[1]) || 40))
.map(Math.random)
.map(function (n) {return n*62})
.map(Math.floor)
.map(String.prototype.charAt.bind('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'))
.join('')
@matthieuprat
Copy link
Author

Use it:

curl -sL https://git.io/vqnyl | node -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment