summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2020-02-06 13:45:24 +0500
committerAnton Bobov <abobov@gmail.com>2020-02-08 23:35:07 +0500
commitd5c22685624a4c4e4ac039a5c23782245f95385b (patch)
tree11e17e1070549cfdfeaacea7593729b822efd893
parent69c820a66463a0416ff6fc230644f40d912a3cbd (diff)
Update.
-rwxr-xr-xd-backup12
-rwxr-xr-xocr_screen18
2 files changed, 28 insertions, 2 deletions
diff --git a/d-backup b/d-backup
index 46d64a4..77361d9 100755
--- a/d-backup
+++ b/d-backup
@@ -21,6 +21,7 @@ print_help() {
cat <<EOF
Commands:
backup run backup
+ cleanup cleanup
stats show collection status
list list files from backup
restore restore files from backup
@@ -30,12 +31,16 @@ EOF
}
backup() {
- duplicity cleanup --force "$TARGET"
- duplicity remove-all-but-n-full 3 --force "$TARGET"
nice ionice duplicity \
--exclude-filelist "$HOME/.duplicity-exclude" \
--full-if-older-than 2M \
"$SOURCE" "$TARGET"
+ cleanup
+}
+
+cleanup() {
+ duplicity cleanup --force "$TARGET"
+ duplicity remove-all-but-n-full 3 --force "$TARGET"
}
stats() {
@@ -60,6 +65,9 @@ while (( "$#" )) ; do
backup)
backup
;;
+ cleanup)
+ cleanup
+ ;;
stats)
stats
;;
diff --git a/ocr_screen b/ocr_screen
new file mode 100755
index 0000000..fc9cb76
--- /dev/null
+++ b/ocr_screen
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if [ ! -x "$(command -v tesseract)" ] ; then
+ echo "No tesseract executable"
+ exit 1
+fi
+if [ ! -x "$(command -v scrot)" ] ; then
+ echo "No scrot executable"
+ exit 1
+fi
+
+TEMP_FILE=$(mktemp --suffix .png)
+L=${1:-eng}
+trap "rm $TEMP_FILE" EXIT
+
+scrot --select --quality 100 --overwrite "$TEMP_FILE"
+mogrify -modulate 100,0 -resize 400% "$TEMP_FILE"
+tesseract -l $L "$TEMP_FILE" - 2>/dev/null | sed '/ /d' | xclip -sel clip