Skip to content

Instantly share code, notes, and snippets.

@ObjectBoxPC
Created January 4, 2022 09:00
Show Gist options
  • Save ObjectBoxPC/c80fce7fc242fce195ae42f4edafff6f to your computer and use it in GitHub Desktop.
Save ObjectBoxPC/c80fce7fc242fce195ae42f4edafff6f to your computer and use it in GitHub Desktop.
Quickly generate random passwords using built-in utilities (emulating Python's secrets.token_urlsafe: https://gist.github.com/ObjectBoxPC/89206ca79bb26fdc2112233ede121d9d )
#!/bin/sh
ENTROPY_BYTES=16
dd if=/dev/urandom bs="$ENTROPY_BYTES" count=1 2> /dev/null | \
base64 -w 0 | sed -e 's/=//g' -e 's/+/-/g' -e 's/\//_/g'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment