Skip to content

Instantly share code, notes, and snippets.

@arrdem
Last active March 24, 2019 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arrdem/15463c30ff4b094450ff191161efc011 to your computer and use it in GitHub Desktop.
Save arrdem/15463c30ff4b094450ff191161efc011 to your computer and use it in GitHub Desktop.
#!/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