Last active
March 24, 2019 04:01
-
-
Save arrdem/15463c30ff4b094450ff191161efc011 to your computer and use it in GitHub Desktop.
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 -S pex proquint -- | |
"""Compute random proquints as hostnames, throw 'em in zones.""" | |
import sys | |
from random import randint | |
from proquint import uint2quint_str | |
# eight bits of provider addressing | |
ZONES = {"sfo2", "wbu1"} | |
if __name__ == "__main__" or 1: | |
zone = sys.argv[1].lower() | |
assert zone in ZONES | |
# Library's cursed, only does 32bi ints although proquints are easily defined wider | |
node_id = uint2quint_str(randint(0, 0xFFFFFFFF)) | |
print(f"{node_id}.{zone}.arrdem.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment