diff options
author | Soispha <soispha@vhack.eu> | 2024-01-13 12:28:04 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-01-13 12:28:04 +0100 |
commit | f45cd3186a14c7b2f40e8662a77a083d366647c8 (patch) | |
tree | 0bc7ff90f805b06ae9037c56773b1b99c91f66d7 | |
parent | feat(hm/pkgs/scr/show): init (diff) | |
download | nixos-config-f45cd3186a14c7b2f40e8662a77a083d366647c8.tar.gz nixos-config-f45cd3186a14c7b2f40e8662a77a083d366647c8.zip |
feat(hm/pkgs/scr/nato): init
Diffstat (limited to '')
-rw-r--r-- | hm/soispha/pkgs/scripts.nix | 6 | ||||
-rwxr-xr-x | hm/soispha/pkgs/scripts/small_functions/nato | 106 |
2 files changed, 112 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix index ec90c8f8..5b240eae 100644 --- a/hm/soispha/pkgs/scripts.nix +++ b/hm/soispha/pkgs/scripts.nix @@ -108,6 +108,11 @@ keep_path = true; # I might want to use nvim in less (and shell escapes) dependencies = builtins.attrValues {inherit (pkgs) less locale;}; }; + nato-scr = write_python { + name = "nato"; + path = "small_functions"; + dependencies_python = ps: []; + }; neorg-scr = sysLib.writeShellScript { name = "neorg"; keep_path = true; @@ -279,6 +284,7 @@ in [ lock-scr lyrics-scr mpc-rm-scr + nato-scr neorg-scr nest_comments-scr screenshot_persistent-scr diff --git a/hm/soispha/pkgs/scripts/small_functions/nato b/hm/soispha/pkgs/scripts/small_functions/nato new file mode 100755 index 00000000..e9d15f56 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/nato @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# originally from here: https://cgit.pacien.net/desktop-utilities/ + +import sys + +alphabet = { + "nato": { + "A": "Alfa", # No idea why this is not just 'Alpha' .. + "B": "Bravo", + "C": "Charlie", + "D": "Delta", + "E": "Echo", + "F": "Foxtrot", + "G": "Golf", + "H": "Hotel", + "I": "India", + "J": "Juliett", + "K": "Kilo", + "L": "Lima", + "M": "Mike", + "N": "November", + "O": "Oscar", + "P": "Papa", + "Q": "Quebec", + "R": "Romeo", + "S": "Sierra", + "T": "Tango", + "U": "Uniform", + "V": "Victor", + "W": "Whiskey", + "X": "X-ray", + "Y": "Yankee", + "Z": "Zulu", + "0": "Nadazero", + "1": "Unaone", + "2": "Bissotwo", + "3": "Terrathree", + "4": "Kartefour", + "5": "Pantafive", + "6": "Soxisix", + "7": "Setteseven", + "8": "Oktoeight", + "9": "Novenine", + ",": "Comma", + "/": "Forward slash", + ".": "Stop/Decimal", + }, + "german": { + "A": "Aachen", + "Ä": "Umlaut Aachen", + "B": "Berlin", + "C": "Chemnitz", + "D": "Düsseldorf", + "E": "Essen", + "F": "Frankfurt", + "G": "Goslar", + "H": "Hamburg", + "I": "Ingelheim", + "J": "Jena", + "K": "Köln", + "L": "Leipzig", + "M": "München", + "N": "Nürnberg", + "O": "Offenbach", + "Ö": "Umlaut Offenbach", + "P": "Potsdam", + "Q": "Quickborn", + "R": "Rostock", + "S": "Salzwedel", + "ẞ": "Eszett", + "T": "Tübingen", + "U": "Unna", + "Ü": "Umlaut Unna", + "V": "Völklingen", + "W": "Wuppertal", + "X": "Xanten", + "Y": "Ypsilon", + "Z": "Zwickau", + }, +} + + +def str_to_telephony(phrase, language): + language_alphabet = alphabet[language] + + return [ + language_alphabet[c] if c in language_alphabet else c for c in phrase.upper() + ] + + +language = sys.argv[1] +if language not in ["nato", "german"]: + print( + f"Langugae '{language}' is not a valid language, only 'nato' and 'german' are!", + file=sys.stderr, + ) + exit(1) + +print( + "\n".join( + str_to_telephony( + " ".join(sys.argv[2:]), + language, + ) + ) +) |