Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dblume
Created March 20, 2021 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dblume/16bc8212b01d71a674617ca00e147d92 to your computer and use it in GitHub Desktop.
Save dblume/16bc8212b01d71a674617ca00e147d92 to your computer and use it in GitHub Desktop.
Find a QR code with as few black dots as possible.
#!/usr/bin/env bash
#
# Spoiler:
# $ ./qrcodes.sh | sort | head
# 416 http://7c.dblu.me
# 416 https://j.dblu.me
# 416 http://wc.dblu.me
# 420 http://2E.dblu.me
# 420 http://73.dblu.me
#
set -eu -o pipefail # See: https://sipb.mit.edu/doc/safe-shell/
f () {
echo $(qrencode -t ASCII $1 | tr -cd '#' | wc -c) $1
}
for X in {a..z} {A..Z} {0..9}
do
f http://dblu.me/$X
f https://dblu.me/$X
f http://dblu.me/$X/
f http://$X.dblu.me
f https://$X.dblu.me
f http://$X.dblu.me/
f http://$X.dlma.com
f http://dlma.com/$X
for Y in {a..z} {A..Z} {0..9}
do
f http://dblu.me/$X$Y
f http://$X$Y.dblu.me
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment