Skip to content

Instantly share code, notes, and snippets.

@mas-4
Last active June 13, 2020 20:09
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 mas-4/8db0ee9fc2ed7f79e1e3439f30b0f248 to your computer and use it in GitHub Desktop.
Save mas-4/8db0ee9fc2ed7f79e1e3439f30b0f248 to your computer and use it in GitHub Desktop.
GPG Backup LaTeX PDF generator, run with `pdflatex --shell-escape gpgbackup.tex`, https://gist.github.com/joostrijneveld/59ab61faa21910c8434c#gistcomment-2339185
\documentclass{article}
\usepackage{float}
\usepackage{graphicx}
\usepackage{pgffor}
\def\gpgkey{yourkeyname}
\newcommand\gpgtopng{
\immediate\write18{gpg --export-secret-key \gpgkey | paperkey --output-type raw | base64 > temp}
\immediate\write18{split temp -n 4 IMG}
\immediate\write18{for f in IMG*; do cat $f | qrencode -o /tmp/$f.png; done}
\immediate\write18{rm IMG* temp}
}
\gpgtopng
\begin{document}
\foreach \l in {a, ..., d} {
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{/tmp/IMGa\l.png}
\caption{QR \l}
\end{figure}
}
To recover run the following command
\begin{verbatim}
for f in IMG*.png; do zbarimg --raw $f | head -c -1 > $f.out ; done
cat *.out | base64 -d | paperkey --pubring ~/.gnupg/pubring.gpg | gpg --import
\end{verbatim}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment