add overkill rune generator

This commit is contained in:
Daylin Morgan 2024-08-06 13:45:28 -05:00
parent 7fe4f7bd55
commit 3bc01c9143
Signed by: daylin
GPG key ID: 950D13E9719334AD
6 changed files with 121 additions and 68 deletions

View file

@ -1,22 +1,3 @@
# Runes
<table>
<tr>
<td>
<img src="https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png">
</td>
<td>
<img src="https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png">
</td>
</tr>
<tr>
<td>
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/Runic_letter_mannaz.png">
</td>
<td>
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b9/Runic_letter_naudiz.png">
</td>
</tr>
</table>
<table><tr><td><img src="https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png"></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png"></td></tr><tr><td><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/Runic_letter_mannaz.png"></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/b/b9/Runic_letter_naudiz.png"></td></tr></table>

View file

@ -14,8 +14,10 @@
'';
ascii = ''
:%+ ## +%:
-%@+ @@ +@%-
-%@=%%=@%-
@ -29,5 +31,6 @@
@%
@@
##
'';
}

62
modules/runes/generate.nu Executable file
View file

@ -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 + $'<td><img src="($it.url)"></td>'
}
}
def row [] { $"<tr>($in)</tr>" }
def readme [] {
let runes = $in
let dims = { rows: 2 cols: 2 }
let cells = ($runes | chunks $dims.rows | each { $in | col | row})
let table = [ "<table>" ...$cells "</table>" ] | 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`!"

View file

@ -1,7 +1,7 @@
{
braille = ''
@ -14,8 +14,10 @@
'';
ascii = ''
:%*: :+%=
-@%%%*- -*%%#@+
-@- .=#@##@#=: .@+
@ -29,5 +31,6 @@
-@= :@+
-@= :@+
-%- :%=
'';
}

View file

@ -1,6 +1,7 @@
{
braille = ''
@ -13,9 +14,10 @@
'';
ascii = ''
+%.
*@.
*@.
@ -29,5 +31,6 @@
*@.
*@.
+%.
'';
}

View file

@ -1,22 +1,6 @@
{
ascii = ''
.+.
.*@@@*.
.+@@- -%@*.
.+@@= -%@*.
.+@%= -%@+.
+@@- :@@*
.*@%- :#@*:
.#@%: :#@#:
:#@#-*@#:
=@@@+
.*@#-#@#:
.*@%- :#@#:
.*@%- :%@*.
+@%- -%@+
:- -:
'';
braille = ''
@ -32,4 +16,21 @@
'';
ascii = ''
=+
-%@@@=
:%@+ =@%-
.#@*. +@#:
*@#. *@#.
+@%: :#@+
+@#: .#@*.
.*@*..*@#.
.#@@%.
=%##@=
-%@= -@@=
:%@+ =@%-
.#@+ +@#.
=. .=
'';
}