QR Codes on Tools / Around the Space

Thanks Max!

Here’s some browser console code to grab all the tools

child_text = (elem) => [...elem.childNodes].filter(elem => elem.nodeType == Node.TEXT_NODE).map(elem => elem.textContent).join('');
copy([...$$('.cooked li > a')].map(e => [child_text(e.parentNode).replace(/^\s*\-\s*/, '').trim(), e.innerText, e.href]).map(l => l.join("\t")).join("\n"))

And here’s using command line tools qrencode and imagemagick to build nifty QR codes, abusing the 30% redundancy in -l H qr codes. A 96x96 px logo works well.

#! /bin/bash
logo="logo.png"
while IFS="," read -r model tool print induction lone url
do
if [ "$print" == "Y"  ]; then
	filename=$(echo "$model $tool" | sed -r 's/[^A-Za-z0-9_]+/_/g; s/(^\_)|(\_$)//g')
	filename="./out/$filename.png"
	[[ $model = "" ]] && label="$tool" || label="$model"
	[[ $induction = "" ]] && i_text="No Induction" || i_text="Induction Required"
	[[ $lone = "" ]] && l_text="Lone Work Permitted" || l_text="No Lone Working"

	qrencode -s 10 -l H -o "$filename" "$url"
	convert -size 570x770 xc:white -gravity Center "$filename" -composite "$logo" -composite -background none -font Helvetica -pointsize 60 \
	-gravity North caption:"$label" -geometry +0+25 -composite \
	-gravity South caption:"$i_text" -geometry +0+50 -composite \
	-gravity South caption:"$l_text" -geometry +0+0 -composite "$filename"
fi;
done < <(tail -n +2 tool_list.csv

I will keep this comment updated as we complete the process.

6 Likes