Skip to main content

Remove another script I no longer use

ID
3a08b3d
date
2025-05-23 21:29:00+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
35dbca1
message
Remove another script I no longer use
changed files
1 file, 93 deletions

Changed files

create_username (2341) → create_username (0)

diff --git a/create_username b/create_username
deleted file mode 100755
index 16794f2..0000000
--- a/create_username
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python3
-"""
-On sites where I don't want to use my standard username (@alexwlchan) --
-for example, if I'm starring content but not creating anything -- I create
-alliterative usernames from the names provided by Docker.
-
-e.g. on GitHub I might use "goofy_galileo"
-
-This script generates an alliterative username for me.
-
-Usage: pass a single letter as first argument, and it offers five suggestions:
-
-    $ ./usernames.py a
-    angry_almeida
-    admiring_ardinghelli
-    admiring_austin
-    amazing_aryabhata
-    admiring_albattani
-
-"""
-
-import os
-import random
-import sys
-import tempfile
-from typing import TypedDict
-
-import httpx
-
-
-def get_name_options() -> tuple[list[str], list[str]]:
-    resp = httpx.get(
-        "https://raw.githubusercontent.com/moby/moby/master/pkg/namesgenerator/names-generator.go"
-    )
-    resp.raise_for_status()
-
-    go_src = resp.text
-
-    # The adjectives are an array of strings:
-    #
-    #       var (
-    #           left = [...]string{
-    #               "admiring",
-    #               "adoring",
-    #               ...
-    #               "zen",
-    #           }
-    #
-    adjectives_src = go_src.split("left = [...]string{")[1].split("}")[0]
-
-    # The names are another array of strings, but with comments on names
-    # to explain their significance:
-    #
-    #           right = [...]string{
-    #               // Muhammad ibn Jābir ...
-    #               "albattani",
-    #
-    #               ...
-    #
-    #               "zhukovsky",
-    #           }
-    #
-    names_src = go_src.split("right = [...]string{")[1].split("\n)")[0]
-
-    adjectives = [
-        line.strip('\t",') for line in adjectives_src.splitlines() if line.strip('\t",')
-    ]
-
-    names = [
-        line.strip('\t",}')
-        for line in names_src.splitlines()
-        if not line.strip().startswith("//") and line.strip('\t",}')
-    ]
-
-    return adjectives, names
-
-
-if __name__ == "__main__":
-    try:
-        char = sys.argv[1].lower()
-    except IndexError:
-        sys.exit(f"Usage: {__file__} <CHAR>")
-
-    adjectives, names = get_name_options()
-
-    for _ in range(5):
-        print(
-            "%s_%s"
-            % (
-                random.choice([a for a in adjectives if a.startswith(char)]),
-                random.choice([n for n in names if n.startswith(char)]),
-            )
-        )