Last active
June 10, 2016 20:14
-
-
Save kgriffs/40400ed27ae2f5c365f5 to your computer and use it in GitHub Desktop.
A better uuidgen (python)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import uuid | |
result = str(uuid.uuid4()) | |
if sys.stdout.isatty(): | |
print(result) | |
else: | |
sys.stdout.write(result) |
Forces uuid v4 and also handles piping nicely (doesn't output a newline in that case).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save as /usr/local/bin/uuid4 and make executable.