Last active
September 24, 2025 20:35
-
-
Save dwallraff/cd6cedd3d89d9da446165fef8aaffb54 to your computer and use it in GitHub Desktop.
Revisions
-
dwallraff revised this gist
Sep 24, 2025 . 2 changed files with 68 additions and 38 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ #! /usr/bin/env bash #-- Dave Wallraff # First things first, I'm the realest... ### convert scans to OCR'd PDF/A, and encrypt them # curl -sL dwallraff.com/scanned | bash # wrap in a function for curl|bash do_stuff() { echo "Setting up..." echo "-------------" echo MY_OP_SESSION="${!OP_SESSION_*}" TODAY=$(date "+%Y%m%d") TEMPDIR=$(mktemp -d) mkdir -p "$TEMPDIR"/"$TODAY"_1password_backup/files || exit 1 BACKUPDIR="$TEMPDIR"/"$TODAY"_1password_backup # Check if op is installed if [ ! "$(command -v op)" ]; then echo "The op cli is not installed. Aborting..." exit 1 fi # Check if gpg is installed if [ ! "$(command -v gpg)" ]; then echo "gpg is not installed. Aborting..." exit 1 fi # Check if gpg is installed if [ ! "$(command -v img2pdf)" ]; then echo "gpg is not installed. Aborting..." exit 1 fi # Check if gpg is installed if [ ! "$(command -v ocrmypdf)" ]; then echo "gpg is not installed. Aborting..." exit 1 fi # Check to ee if we need to log in if [ "$MY_OP_SESSION" = "" ]; then echo "You're not logged into op" echo "eval \$(op signin)" exit 1 fi # Loop over jpegs, convert to pdf, and encrypt if ! exec 3<<<"$(op read op://Personal/secure_tarball_passphrase/password)"; then echo "Couldn't get tarball passphrase. Cleaning up and aborting..." rm -r "$TEMPDIR" exit 1 fi for i in *.jpeg; do echo "Converting $i..." img2pdf "$i" | ocrmypdf -j1 -q --output-type pdfa --pdfa-image-compression jpeg --optimize 3 --deskew --clean - "$TODAY"_"${i%%.*}".pdf exec 3<<<"$(op read op://Personal/secure_tarball_passphrase/password" gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_"${i%%.*}".pdf.enc "$TODAY"_"${i%%.*}".pdf done } do_stuff 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 charactersOriginal file line number Diff line number Diff line change @@ -1,38 +0,0 @@ -
dwallraff revised this gist
Nov 12, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ do_stuff() { # Loop over jpegs, convert to pdf, and encrypt for i in *.jpeg; do echo "Converting $i..." img2pdf "$i" | ocrmypdf -j1 -q --output-type pdfa --pdfa-image-compression jpeg --optimize 3 --deskew --clean - "$TODAY"_"${i%%.*}".pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_"${i%%.*}".pdf.enc "$TODAY"_"${i%%.*}".pdf done -
dwallraff revised this gist
Nov 12, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,9 +17,9 @@ do_stuff() { # Check if op is logged in if ! op whoami > /dev/null 2>&1; then echo "Not logged into 1password" echo "Please run: eval \"\$(op account add --account my.1password.comn --email [email protected] --address my.1password.com --signin)\"" exit 1 fi # Needed vars -
dwallraff revised this gist
Nov 12, 2023 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,10 +16,10 @@ do_stuff() { fi # Check if op is logged in if ! op whoami > /dev/null 2>&1; then echo "Not logged into 1password" echo "Please run: eval \"\$(op account add --account my.1password.comn --email [email protected] --address my.1password.com --signin)\"" exit 1 fi # Needed vars -
dwallraff revised this gist
Jul 30, 2022 . No changes.There are no files selected for viewing
-
dwallraff revised this gist
Jul 30, 2022 . 1 changed file with 36 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,38 @@ #! /usr/bin/env bash #-- Dave Wallraff # First things first, I'm the realest... ### convert scans to OCR'd PDF/A, and encrypt them # curl -sL dwallraff.com/scanned | bash # wrap in a function for curl|bash do_stuff() { # Check if op is installed if [ ! "$(command -v op)" ]; then echo "The op cli is not installed. Aborting..." exit 1 fi # Check if op is logged in if ! op user list > /dev/null 2>&1; then echo "Not logged into 1password" echo "Please run: eval \"\$(op signin)\"" exit 1 fi # Needed vars TODAY=$(date "+%Y%m%d") # Loop over jpegs, convert to pdf, and encrypt for i in *.jpeg; do echo "Converting $i..." img2pdf "$i" | ocrmypdf -q --output-type pdfa --pdfa-image-compression jpeg --optimize 3 --deskew --clean - "$TODAY"_"${i%%.*}".pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_"${i%%.*}".pdf.enc "$TODAY"_"${i%%.*}".pdf done } do_stuff -
dwallraff revised this gist
Jul 24, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fi for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --pdfa-image-compression jpeg --optimize 3 --deskew --clean - "$TODAY"_${i%%.*}.pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_${i%%.*}.pdf.enc "$TODAY"_${i%%.*}.pdf done -
dwallraff revised this gist
Jul 23, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,5 +15,5 @@ for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - "$TODAY"_${i%%.*}.pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_${i%%.*}.pdf.enc "$TODAY"_${i%%.*}.pdf done -
dwallraff revised this gist
Jul 23, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fi for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - "$TODAY"_${i%%.*}.pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" tar hcz ${i%%.*}.pdf | gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output "$TODAY"_${i%%.*}.pdf.tar.gz.enc done -
dwallraff revised this gist
Jul 23, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export TODAY=$(date "+%Y%m%d") # Check if op is logged in echo "Checking if op is logged in" op user list > /dev/null 2>&1 # if not, log in or die trying if [ $? -ne 0 ]; then echo "Logging into op..." -
dwallraff revised this gist
Jul 23, 2022 . 1 changed file with 16 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,19 @@ #! /usr/bin/env bash export TODAY=$(date "+%Y%m%d") # Check if op is logged in echo "Checking if op is logged in" op list users > /dev/null 2>&1 # if not, log in or die trying if [ $? -ne 0 ]; then echo "Logging into op..." eval $(op signin) fi for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - $TODAY_${i%%.*}.pdf exec 3<<<"$(op item get encrypted_tar_password --format json | jq -r '.fields[] | select(.id=="password") | .value')" tar hcz ${i%%.*}.pdf | gpg --batch --cipher-algo AES256 --passphrase-fd 3 --symmetric --output $TODAY_${i%%.*}.pdf.tar.gz.enc done -
dwallraff renamed this gist
Jul 22, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,6 @@ for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - ${i%%.*}.pdf done # tar hcz *.pdf | gpg --batch --cipher-algo AES256 --symmetric --output "$TODAY"_scanned_mail.tar.gz.enc -
dwallraff revised this gist
Jul 22, 2022 . 1 changed file with 2 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,5 @@ #! /usr/bin/env bash for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - ${i%%.*}.pdf done -
dwallraff revised this gist
Jul 20, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,6 @@ cd ~/images || die for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - "$TODAY"_${i%%.*}.pdf done tar hcz *.pdf | gpg --batch --cipher-algo AES256 --symmetric --output "$TODAY"_scanned_mail.tar.gz.enc -
dwallraff revised this gist
Jul 20, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ export TODAY=$(date "+%Y%m%d") cd ~/images || die for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - "$TODAY"_${i%%.*}.pdf done -
dwallraff created this gist
Jul 20, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ #! /usr/bin/env bash export TODAY=$(date "+%Y%m%d") cd ~/images || die for i in $(ls *.jpeg); do echo "Converting $i..." img2pdf $i | ocrmypdf -q --output-type pdfa --deskew --clean - "$TODAY"_$i.pdf done