Initial commit with handy scripts
This commit is contained in:
commit
074a8c3187
5 changed files with 129 additions and 0 deletions
20
linux/python/make_random.py
Normal file
20
linux/python/make_random.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from uuid import uuid4
|
||||
from argparse import ArgumentParser
|
||||
|
||||
def generate(length: int, current = ""):
|
||||
if len(current) >= length:
|
||||
return current[:length]
|
||||
|
||||
next = current + str(uuid4()).replace("-", "")
|
||||
return generate(length, current = next)
|
||||
|
||||
def main(num: int) -> None:
|
||||
print(generate(num))
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser(prog="Make Random", description="Creates a random GUID-like value of a provided length")
|
||||
parser.add_argument('num')
|
||||
|
||||
args = parser.parse_args()
|
||||
main(int(args.num))
|
||||
|
||||
Loading…
Reference in a new issue