Created
March 18, 2015 12:25
-
-
Save plesner/10c2cac0161394e7cf21 to your computer and use it in GitHub Desktop.
Utility for encoding files as qr-codes on paper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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