Skip to content

Instantly share code, notes, and snippets.

@feklee
feklee / sort_media_files
Last active January 10, 2024 22:30
Sorts media files into directories and timestamps the file names
#!/usr/bin/perl
# Run without parameters to see usage.
# Felix E. Klee <[email protected]>
use strict;
use warnings;
use Image::ExifTool qw(:Public);
use File::Find;
@feklee
feklee / geotag
Last active January 10, 2024 08:52
Geotags image files
#!/bin/bash
# Felix E. Klee <[email protected]>
if [ $# -ne 2 ]; then
cat <<EOF
Usage: $0 GPSDIR DIR
Geotags image files in DIR using GPS tracks stored in GPSDIR. The
tags are added in Exif data. Files that already are geotagged are not
@feklee
feklee / time_stamp_media_filenames
Last active January 8, 2024 09:27
Prepends media file names with time stamps of media creation in local time
#!/usr/bin/perl
# Traverses media files in the specified directory tree.
# Prepends the media creation time as a time stamp in the format
# "%HH%MM%SS_" to each media file name where the data is
# available. The time is local time.
# What looks like an existing time stamp is replaced.
@feklee
feklee / backup
Last active September 5, 2024 11:30
Creates a backup of linux.f76.eu
#!/bin/sh
# Creates a backup of my machine: linux.f76.eu
# Felix E. Klee <[email protected]>
LANG="en_US" # Sets locale to US english
BACKUP_DIR=~/"Syncthing/temp_backup/Internet/linux.f76.eu/"
BACKUP_FILE="backup.tar.gpg"
echo "Making backup to"
@feklee
feklee / append_to_encrypted_pdf
Last active June 15, 2022 17:45
Appends a PDF file to a PGP encrypted PDF file
#!/bin/bash
# Felix E. Klee <[email protected]>
set -e
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} PGP_ENCRYPTED_PDF NEW_PDF PGP_ENCRYPTED_RESULT
@feklee
feklee / docurl.el
Last active January 17, 2022 15:41
To browse files associated with DocURLs
;; About DocURLs, see: http://f76.eu/a0
;;
;; Felix E. Klee <[email protected]>
(defgroup docurl nil
"Support for browsing DocURLs"
:group 'communication)
(defcustom docurl-cache-filename
"~/.local/share/docurl_cache"
@feklee
feklee / find_docurl_images
Last active January 10, 2022 20:48
Finds images that contain DocURLs in their EXIF data
#!/bin/bash
# Finds images that contain DocURLs in their EXIF data, because I
# remember that I once had the idea to put them there. Hopefully
# there are none.
# Felix E. Klee <[email protected]>
find -regex ".*\.jpe?g" | while read a; do
r=$(exiftool "$a" | grep -i docurl) && echo "$a: '$r'"
@feklee
feklee / parse_docurls
Last active April 3, 2024 09:10
Finds URLs of files in my directory tree
#!/usr/bin/perl
# All URLs of the format <http://f76.eu/a*> are for identifying my
# documents. See: http://f76.eu/a0
#
# This script finds all files when run from the root of the directory
# tree with my documents.
# Example confguration `~/.config/parse_docurls.conf`:
#
@feklee
feklee / fake_gpg
Created January 2, 2022 16:37
Wrapper script to use GPG with an expired key
#!/bin/bash
/usr/bin/gpg2 --faked-system-time 20200101T000000 "$@"
@feklee
feklee / x11vnc
Last active May 4, 2021 20:20
Sxmo script for remote access
#!/bin/sh
# Allows maintaining of an Sxmo session on a PinePhone via VNC.
# Felix E. Klee <[email protected]>
st -e sh -c "x11vnc -auth guess -once -loop -noxdamage -repeat -rfbport 5900 -shared"