diff options
author | makefu <github@syntax-fehler.de> | 2022-01-28 23:18:53 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2022-01-28 23:18:53 +0100 |
commit | 554ded629cae52c0f27e5a196dff4a7e2674eb4e (patch) | |
tree | bc4e2cf27f9bad061f997599e94f1e204592fb7b | |
parent | 984ee05ec2b1ff8c7caba3d2580e8f7978f267b8 (diff) | |
parent | d8b64c4f1367e21ffea0c68d987e22480f5e8899 (diff) |
Merge remote-tracking branch 'lass/master'
-rw-r--r-- | krebs/3modules/external/kmein.nix | 1 | ||||
-rw-r--r-- | krebs/5pkgs/simple/krebsdance/default.nix | 173 | ||||
-rw-r--r-- | lass/1systems/mors/config.nix | 1 | ||||
-rw-r--r-- | lass/2configs/sync/the_playlist.nix | 9 |
4 files changed, 119 insertions, 65 deletions
diff --git a/krebs/3modules/external/kmein.nix b/krebs/3modules/external/kmein.nix index 9ef079090..1e4a68057 100644 --- a/krebs/3modules/external/kmein.nix +++ b/krebs/3modules/external/kmein.nix @@ -123,6 +123,7 @@ in "zaatar.kmein.r" "grocy.kmein.r" "moodle.kmein.r" + "radio.kmein.r" ]; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- diff --git a/krebs/5pkgs/simple/krebsdance/default.nix b/krebs/5pkgs/simple/krebsdance/default.nix index bcb859a21..cdfe23ef2 100644 --- a/krebs/5pkgs/simple/krebsdance/default.nix +++ b/krebs/5pkgs/simple/krebsdance/default.nix @@ -1,114 +1,157 @@ { writers }: -writers.writePython3Bin "krebsdance" {} '' +writers.writePython3Bin "krebsdance" { flakeIgnore = [ "E501" ]; } '' import argparse import random + import itertools claws = [ dict( - up='(\\/)', - down='(/\\)', - left='(\\\\)', - right='(//)', + up="(\\/)", + down="(/\\)", + left="(\\\\)", + right="(//)", ), dict( - up='(V)', - down='(A)', - left='>)=', - right='=(<', + up="(V)", + down="(A)", + left=">)=", + right="=(<", ), dict( - up='(U)', - down='(n)', - left=')==', - right='==(', + up="(U)", + down="(n)", + left=")==", + right="==(", ), ] eyes = [ - '°', - '*', - '^', - 'ö', - 'o', - 'O', - 'X', - 'x', - 'U', - 'u', + "°", + "*", + "^", + "ö", + "o", + "O", + "X", + "x", + "U", + "u", ] bodies = [ dict( - left='(', - right=')', + left="(", + right=")", ), dict( - left='{', - right='}', + left="{", + right="}", ), dict( - left='[', - right=']', + left="[", + right="]", ), dict( - left='<', - right='>', + left="<", + right=">", ), dict( - left='|', - right='|', + left="|", + right="|", ), ] mouths = [ - ',,,,', - ',mm,', - '_mm_', - '-mm-', - ';;;;', - ';mm;', - ':mm:', - '::::', - ':ww:', - ':<>:', + ",,,,", + ",mm,", + "_mm_", + "-mm-", + ";;;;", + ";mm;", + ":mm:", + "::::", + ":ww:", + ":<>:", ] + def all_krebses(): + for mouth, body, eye, claw in itertools.product(mouths, bodies, eyes, claws): + yield f'{claw["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {claw["up"]}' + + + def escape_graph(text): + return text.replace("\\", "\\\\") + + + def krebs_graph() -> str: + return "\n".join(itertools.chain( + ["digraph {"], + [escape_graph(f'"{krebs}"->"{generate(seed=krebs)}"') for krebs in all_krebses()], + "}", + )) + + + def generate(*, seed: str, dancing: bool = False) -> str: + if seed: + random.seed(seed) + clawstyle = random.choice(claws) + body = random.choice(bodies) + eye = random.choice(eyes) + mouth = random.choice(mouths) + if dancing: + return "\n".join( + [ + f'{clawstyle["down"]} {body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["up"]}', + f'{clawstyle["left"]}{body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["right"]}', + f'{clawstyle["right"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["left"]}', + f'{clawstyle["down"]}{body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["down"]}', + ] + ) + else: + return f'{clawstyle["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["up"]}' + + + def fixpoints(): + for krebs in all_krebses(): + if generate(seed=krebs) == krebs: + yield krebs + + def main(): parser = argparse.ArgumentParser() parser.add_argument( - 'seed', - nargs='?', - help='random seed to use for generating the krebs variant', + "seed", + nargs="?", + help="random seed to use for generating the krebs variant", ) parser.add_argument( - '--dance', '-d', - dest='dance', - help='if the krebs should dance', + "--dance", + "-d", + dest="dance", + help="if the krebs should dance", default=False, - action='store_true', + action="store_true", ) - args = parser.parse_args() + parser.add_argument( + "--mode", + "-m", + dest="mode", + choices=["graphviz", "plain"], + default="plain", + ) - if args.seed: - random.seed(args.seed) + args = parser.parse_args() - clawstyle = random.choice(claws) - body = random.choice(bodies) - eye = random.choice(eyes) - mouth = random.choice(mouths) - if args.dance: - print(f'{clawstyle["down"]} {body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["up"]}') # noqa - print(f' {clawstyle["left"]}{body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["right"]}') # noqa - print(f'{clawstyle["right"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["left"]}') # noqa - print(f' {clawstyle["down"]}{body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["down"]}') # noqa - else: - print(f'{clawstyle["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["up"]}') # noqa + if args.mode == "plain": + print(generate(seed=args.seed, dancing=args.dance)) + elif args.mode == "graphviz": + print(krebs_graph()) - if __name__ == '__main__': + if __name__ == "__main__": main() '' diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix index 4d042de22..dd479f267 100644 --- a/lass/1systems/mors/config.nix +++ b/lass/1systems/mors/config.nix @@ -26,6 +26,7 @@ with import <stockholm/lib>; <stockholm/lass/2configs/sync/sync.nix> <stockholm/lass/2configs/sync/decsync.nix> <stockholm/lass/2configs/sync/weechat.nix> + <stockholm/lass/2configs/sync/the_playlist.nix> #<stockholm/lass/2configs/c-base.nix> <stockholm/lass/2configs/br.nix> <stockholm/lass/2configs/ableton.nix> diff --git a/lass/2configs/sync/the_playlist.nix b/lass/2configs/sync/the_playlist.nix new file mode 100644 index 000000000..5bbf790a7 --- /dev/null +++ b/lass/2configs/sync/the_playlist.nix @@ -0,0 +1,9 @@ +{ + services.syncthing.folders.the_playlist = { + path = "/home/lass/tmp/the_playlist"; + devices = [ "mors" "phone" "prism" ]; + }; + lass.acl."/home/lass/tmp/the_playlist"."u:syncthing:X".parents = true; + lass.acl."/home/lass/tmp/the_playlist"."u:syncthing:rwX" = {}; + lass.acl."/home/lass/tmp/the_playlist"."u:lass:rwX" = {}; +} |