Skip to content

Instantly share code, notes, and snippets.

@arobb
Last active February 23, 2021 14:45
Show Gist options
  • Save arobb/87f3a3d432734f2b9b7a99d9d952dc45 to your computer and use it in GitHub Desktop.
Save arobb/87f3a3d432734f2b9b7a99d9d952dc45 to your computer and use it in GitHub Desktop.
Generate random text
# Bash for macOS and Linux
LC_CTYPE=C tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1
# Python
import binascii, os
length=10
binascii.b2a_hex(os.urandom(length)).decode('utf-8')[0:length]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment