From 4a9225d27fd510f586313a83bcf6949348879ecd Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Wed, 22 May 2024 10:57:36 -0700 Subject: [PATCH] Add a tool that will generate examples using all matrix and hash options This tool will go through the examples directory and generate an image for all *.in files using every hash and matrix option. Signed-off-by: Alek Ratzloff --- tools/genexamples.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 tools/genexamples.sh diff --git a/tools/genexamples.sh b/tools/genexamples.sh new file mode 100755 index 0000000..1d611fb --- /dev/null +++ b/tools/genexamples.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -eo pipefail +here="$(dirname "$(realpath "$0")")" + +hashes=(md5 sha1 sha224 sha256 sha384 sha512) +matrices=(nibble randomart) + +cd "$here/.." + +find "examples" -type f -name '*.in' | \ +while read infile; do + for hash in "${hashes[@]}"; do + for matrix in "${matrices[@]}"; do + outfile="examples/$(basename -s .in "$infile")-$hash-$matrix.svg" + echo "Generating $outfile" + python3 -m colorhash "$infile" --out "$outfile" --hash "$hash" --matrix "$matrix" + done + done +done