Skip to content

Instantly share code, notes, and snippets.

@ahaxu
Last active April 27, 2023 03:58
Show Gist options
  • Save ahaxu/f0ccd3f6c3ff3e970f13aa6535c9cda5 to your computer and use it in GitHub Desktop.
Save ahaxu/f0ccd3f6c3ff3e970f13aa6535c9cda5 to your computer and use it in GitHub Desktop.
gen sketch for cert
#!/bin/bash
set -e
#
# usage:
# cat athelete.txt | xargs -I$ sh -c './ecert-sketch.sh "$"'
#
slugify () {
echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z
}
NAME=$1
UNAME=$(echo "$NAME" | awk '{print toupper($0)}')
SOURCE_BG="./htmt-ecert-bg.jpeg"
OUTPUT=`slugify "$NAME"`
echo $UNAME
echo "wrote file to $OUTPUT-sketch.jpg"
convert -font "iosevka-bold" \
-fill black -pointsize 130 -gravity center \
-draw "text 0,-300 '$UNAME'" \
$SOURCE_BG "$OUTPUT-1.jpg"
convert -font "chalkboard" \
-fill black -pointsize 90 -gravity center \
-draw "text 0,-150 'DISTANCE: KM" \
"$OUTPUT-1.jpg" "$OUTPUT-2.jpg"
convert -font "chalkboard" \
-fill black -pointsize 90 -gravity center \
-draw "text 0,0 'LOOPS: " \
-draw "text 0,150 'TOTAL TIME: " \
"$OUTPUT-2.jpg" "$OUTPUT-sketch.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment