Created
April 29, 2013 20:54
-
-
Save jclement/5484698 to your computer and use it in GitHub Desktop.
Crappy code to split a GPG key in 3 giant QR codes
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
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| LINE_COUNT =40 | |
| def dumpLines(basename, segment, lines): | |
| fn ='%s_%02d.png' % (basename, segment) | |
| print fn | |
| f = os.popen("qrencode -o \"%s\" " % fn,'w') | |
| f.write("%02d\n" % segment) | |
| for ln in lines: | |
| f.write(ln.strip() + "\n") | |
| f.close(); | |
| return fn; | |
| if __name__=='__main__': | |
| if len(sys.argv) <> 2: | |
| print "Syntax: %s outfile << strings" % sys.argv[0] | |
| basename = sys.argv[1] | |
| lines = sys.stdin.readlines() | |
| seg = 0 | |
| f = open(basename + '.html','w') | |
| f.write('<html><body>') | |
| while len(lines) > 0: | |
| seg = seg +1; | |
| chunk = lines[:LINE_COUNT] | |
| lines = lines[LINE_COUNT:] | |
| fn = dumpLines(basename, seg, chunk); | |
| f.write('<img src="%s" /><br/>' % fn); | |
| f.write('</body></html>') | |
| f.close(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: Having difficulty scanning these QR codes. Likely more smaller QR codes would work better.