Skip to content

Instantly share code, notes, and snippets.

@plesner
Created March 18, 2015 12:25
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 plesner/10c2cac0161394e7cf21 to your computer and use it in GitHub Desktop.
Save plesner/10c2cac0161394e7cf21 to your computer and use it in GitHub Desktop.
Utility for encoding files as qr-codes on paper.
#!/bin/sh
# Utility for chopping a file into chunks of a certain number of lines and
# encoding each chunk as a qr code. For storing private keys on paper.
set -e
KEYIN=$1
OUTFMT=key-%i.png
CHUNKSIZE=12
LINES=$(cat $KEYIN | wc -l)
BLOCK=0
for CUT in $(seq 1 $CHUNKSIZE $LINES); do
IMGOUT=$(printf $OUTFMT $BLOCK)
echo Writing $IMGOUT
cat $KEYIN | tail -n +$CUT | head -$CHUNKSIZE | qrencode -l L -8 -o $IMGOUT
BLOCK=$((BLOCK+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment