From 3bc01c914342900cb37aa3b9a50afe912cfc38d4 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 6 Aug 2024 13:45:28 -0500 Subject: [PATCH] add overkill rune generator --- modules/runes/README.md | 21 +------------ modules/runes/algiz.nix | 31 +++++++++++--------- modules/runes/generate.nu | 62 +++++++++++++++++++++++++++++++++++++++ modules/runes/mannaz.nix | 33 +++++++++++---------- modules/runes/naudiz.nix | 7 +++-- modules/runes/othalan.nix | 35 +++++++++++----------- 6 files changed, 121 insertions(+), 68 deletions(-) create mode 100755 modules/runes/generate.nu diff --git a/modules/runes/README.md b/modules/runes/README.md index 211a470..50347ac 100644 --- a/modules/runes/README.md +++ b/modules/runes/README.md @@ -1,22 +1,3 @@ # Runes - - - - - - - - - - -
- - - -
- - - -
- +
diff --git a/modules/runes/algiz.nix b/modules/runes/algiz.nix index f0601e9..4e4ee25 100644 --- a/modules/runes/algiz.nix +++ b/modules/runes/algiz.nix @@ -1,6 +1,6 @@ { braille = '' - ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢠⣾⣦⡀⠀⠀⠀⣶⣶⠀⠀⠀⢀⣴⣷⡄⠀⠀⠀ ⠀⠀⠀⠀⠙⢿⣷⣄⠀⠀⣿⣿⠀⠀⣠⣾⡿⠋⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠙⢿⣷⣄⣿⣿⣠⣾⡿⠋⠀⠀⠀⠀⠀⠀ @@ -14,20 +14,23 @@ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ''; ascii = '' - :%+ ## +%: - -%@+ @@ +@%- - -%@=%%=@%- - =%@@%= - @@ - @% - @% - @% - @% - @% - @% - @@ - ## + + :%+ ## +%: + -%@+ @@ +@%- + -%@=%%=@%- + =%@@%= + @@ + @% + @% + @% + @% + @% + @% + @@ + ## + ''; } diff --git a/modules/runes/generate.nu b/modules/runes/generate.nu new file mode 100755 index 0000000..b55e261 --- /dev/null +++ b/modules/runes/generate.nu @@ -0,0 +1,62 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p nushell ascii-image-converter -i nu + + +let runes = [ + {name: "algiz" url: "https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png" }, + {name: "othalan" url: "https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png" }, + {name: "mannaz" url: "https://upload.wikimedia.org/wikipedia/commons/0/0c/Runic_letter_mannaz.png" }, + {name: "naudiz" url: "https://upload.wikimedia.org/wikipedia/commons/b/b9/Runic_letter_naudiz.png" }, +] + +def convert [] { + let rune = $in + let image = http get $rune.url + let flags = [--height 15 --negative] + { + name: $rune.name + braille: ( $image | ascii-image-converter - --braille ...$flags) + ascii: ( $image | ascii-image-converter - ...$flags) + } +} + +def nix [] { + let rune = $in | convert + $"{ +braille = '' +($rune.braille) +''; +ascii = '' +($rune.ascii) +''; +} +" | save -f $"($rune.name).nix" +} + +def col [] { + $in + | reduce --fold "" {|it, acc| + $acc + $'' + } +} + +def row [] { $"($in)" } + +def readme [] { + let runes = $in + let dims = { rows: 2 cols: 2 } + let cells = ($runes | chunks $dims.rows | each { $in | col | row}) + let table = [ "" ...$cells "
" ] | str join + + $"# Runes\n\n($table)\n" +} + +$runes +| readme +| save -f "README.md" + +$runes +| each {|rune| $rune | nix } + + +print "don't forget to run `nix fmt`!" diff --git a/modules/runes/mannaz.nix b/modules/runes/mannaz.nix index b94d225..f6ff4f9 100644 --- a/modules/runes/mannaz.nix +++ b/modules/runes/mannaz.nix @@ -1,7 +1,7 @@ { braille = '' - ⠀ - ⢰⣶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣶⡆⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⢰⣶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣶⡆⠀⠀ ⠀⠀⢸⣿⡿⢿⣷⣦⣄⠀⠀⠀⠀⣀⣴⣾⡿⠿⣿⡇⠀⠀ ⠀⠀⢸⣿⡇⠀⠈⠛⠿⣿⣶⣴⣿⠿⠛⠁⠀⢸⣿⡇⠀⠀ ⠀⠀⢸⣿⡇⠀⣀⣤⣶⣿⠟⠻⢿⣷⣤⣀⠀⢸⣿⡇⠀⠀ @@ -14,20 +14,23 @@ ⠀⠀⢸⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀ ⠀⠀⢸⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀ ⠀⠀⢸⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡇⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ''; ascii = '' - :%*: :+%= - -@%%%*- -*%%#@+ - -@- .=#@##@#=: .@+ - -@- :=#@#*%#+: .@+ - -@%%%*- :*%%#@+ - -@*: .+@+ - -@- .@+ - -@= :@+ - -@= :@+ - -@= :@+ - -@= :@+ - -@= :@+ - -%- :%= + + :%*: :+%= + -@%%%*- -*%%#@+ + -@- .=#@##@#=: .@+ + -@- :=#@#*%#+: .@+ + -@%%%*- :*%%#@+ + -@*: .+@+ + -@- .@+ + -@= :@+ + -@= :@+ + -@= :@+ + -@= :@+ + -@= :@+ + -%- :%= + ''; } diff --git a/modules/runes/naudiz.nix b/modules/runes/naudiz.nix index b120384..3952304 100644 --- a/modules/runes/naudiz.nix +++ b/modules/runes/naudiz.nix @@ -1,6 +1,7 @@ { braille = '' - ⠀⠀⠀⠀⠀⠀⠀⢰⣶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⢰⣶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ @@ -13,9 +14,10 @@ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - ⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ''; ascii = '' + +%. *@. *@. @@ -29,5 +31,6 @@ *@. *@. +%. + ''; } diff --git a/modules/runes/othalan.nix b/modules/runes/othalan.nix index b86795d..49e3fa4 100644 --- a/modules/runes/othalan.nix +++ b/modules/runes/othalan.nix @@ -1,22 +1,6 @@ { - ascii = '' - .+. - .*@@@*. - .+@@- -%@*. - .+@@= -%@*. - .+@%= -%@+. - +@@- :@@* - .*@%- :#@*: - .#@%: :#@#: - :#@#-*@#: - =@@@+ - .*@#-#@#: - .*@%- :#@#: - .*@%- :%@*. - +@%- -%@+ - :- -: - ''; braille = '' + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡿⢿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢠⣾⣿⠏⠀⠀⠙⢿⣷⣄⠀⠀⠀⠀⠀⠀ @@ -32,4 +16,21 @@ ⠀⠀⢀⣴⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣷⡀⠀⠀ ⠀⠀⠀⠙⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠋⠀⠀⠀ ''; + ascii = '' + + =+ + -%@@@= + :%@+ =@%- + .#@*. +@#: + *@#. *@#. + +@%: :#@+ + +@#: .#@*. + .*@*..*@#. + .#@@%. + =%##@= + -%@= -@@= + :%@+ =@%- + .#@+ +@#. + =. .= + ''; }