Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #-----------------------------------------------------------------------------
- # Use:
- # $ ./storeqr.sh "Filename" "YoUR EncRYPtion KeY"
- # If you get an error message about parallel not liking -N
- # you probably have moreutils installed instead of parallel
- # sudo apt-get install parallel
- #-----------------------------------------------------------------------------
- COUNTER=0
- IFS=$'\n'
- #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N71 echo) #Low/Default error correction
- for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N10 echo) #Low/Default error correction
- #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N56 echo) #Medium error correction
- #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N40 echo) #Q error correction
- #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N30 echo) #High error correction
- do
- let COUNTER+=1
- echo "Working on QRcode $COUNTER"
- PADCOUNT=$(printf "%08d" $COUNTER)
- qrencode -m 8 -o $PADCOUNT.png "$ldata" #Normal/Low error correction
- #qrencode -l M -o $PADCOUNT.png "$ldata" #Medium error correction
- #qrencode -l Q -o $PADCOUNT.png "$ldata" #Q error correction
- #qrencode -l H -o $PADCOUNT.png "$ldata" #high error correction
- convert $PADCOUNT.png -gravity South -pointsize 15 -annotate +0+0 "$PADCOUNT" $PADCOUNT.png
- done
- #convert *.png "$(basename $1).pdf"
- montage -page A4 -compress JPEG *.png -tile 3x4 -geometry 300 "$(basename $1).pdf"
- rm *.png
- #-----------------------------------------------------------------------------
- # To restore file from qrcodes:
- # scan all the qrcodes and save as sequential images, then run
- # $ zbarimg -q --raw *.png | sed 's/[0-9]*//g' |codegroup -d |ccrypt -d -K "YoUR EncRYPtion KeY" |gzip -d > out.file
- #
- # Or scan each QRcode with your phone and save the codegroup text as one block of text then
- # $ cat thesavedcodegroup.txt | codegroup -d |ccrypt -d -K "YoUR EncRYPtion KeY" |gzip -d > out.file
- #-----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement