Skip to content

Instantly share code, notes, and snippets.

@smashism
Last active December 10, 2022 15:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save smashism/8068e42ecd3d0374707f0bf583d3ea83 to your computer and use it in GitHub Desktop.
Save smashism/8068e42ecd3d0374707f0bf583d3ea83 to your computer and use it in GitHub Desktop.
random_sn
randomsn() {
managed_python3 -c "import string; from random import randint, sample; print('VM' + ''.join(sample((string.ascii_lowercase + string.digits),10)))"
}
@smashism
Copy link
Author

smashism commented Sep 5, 2018

Add this to your bash profile to make an alias for randomsn that quickly generates a random serial number of VM+a string of 10 letters and numbers. Great for making well-formed serial numbers for VMs for testing.

@chrismccoy
Copy link

could also do

cat /dev/random | LC_CTYPE=C tr -dc "[:alpha:]" | head -c 10

@smashism
Copy link
Author

smashism commented Feb 1, 2022

roll your own organizational python3
https://github.com/macadmins/python

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