Skip to content

Instantly share code, notes, and snippets.

@jpmens
Created December 8, 2025 14:44
Show Gist options
  • Select an option

  • Save jpmens/775bd8078e477e7b7129e1dda36acc7d to your computer and use it in GitHub Desktop.

Select an option

Save jpmens/775bd8078e477e7b7129e1dda36acc7d to your computer and use it in GitHub Desktop.
#!/bin/sh
[ $# -ne 1 ] && { echo "Usage: $0 URL" >&2; exit 2; }
# I need '*.svg' so that open(1) does its thing. The following
# inserts the variable part *after* the file extension on macos:
# svg=$(mktemp -t gist-XXXXXXXXX.svg)
#
f=$(python3 -c 'import tempfile; \
print("{0}.svg".format(tempfile.NamedTemporaryFile(delete=False).name))')
echo "$f" >&2
qrencode -s 10 -l H -t SVG -o "${f}" "$1"
open -a safari "${f}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment