2024-05-22 10:57:36 -07:00
|
|
|
#!/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
|
2024-05-30 11:38:33 -07:00
|
|
|
svgfile="examples/$(basename -s .in "$infile")-$hash-$matrix.svg"
|
|
|
|
|
pngfile="examples/$(basename -s .in "$infile")-$hash-$matrix.png"
|
|
|
|
|
echo "Generating $svgfile"
|
|
|
|
|
python3 -m colorhash "$infile" --output-type svg --out "$svgfile" --hash "$hash" --matrix "$matrix"
|
2024-05-30 11:55:54 -07:00
|
|
|
#echo "Generating $pngfile"
|
|
|
|
|
#convert "$svgfile" "$pngfile"
|
2024-05-22 10:57:36 -07:00
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
done
|
2024-05-30 12:22:58 -07:00
|
|
|
|
|
|
|
|
# Additionally, create an SVG for the current commit hash
|
|
|
|
|
echo "Generating examples/commithash.svg"
|
|
|
|
|
python3 -m colorhash "$(git rev-parse HEAD)" --input-type hash --hash sha1 --matrix randomart --output-type svg --out examples/commithash.svg
|