Skip to content

Instantly share code, notes, and snippets.

@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 / README.md
Last active February 12, 2024 20:50
GnuPG on Termux for accessing USB smart card reader

Prerequisites

  • smart card reader supported by GnuPG

    I use [0.332][4], a mod of the [SCM332 V2][1] which is comparatively light and small. Previously, I was simply using the SCM332 V2 directly with an OTG adapter.

  • root access from Termux

@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 <felix.klee@inka.de>
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 <felix.klee@inka.de>
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 December 29, 2023 09:53
Creates a backup of linux.f76.eu
#!/bin/sh
# Creates a backup of my machine: linux.f76.eu
# Felix E. Klee <felix.klee@inka.de>
LANG="en_US" # Sets locale to US english
BACKUP_DIR=~/"Dropbox/Temp Backup/Internet/linux.f76.eu/"
BACKUP_FILE="backup.tar.gpg"
echo "Making backup to"
@feklee
feklee / winpath
Last active November 23, 2023 07:26
Prints the path in Windows of a path in my Linux virtual machine
#!/bin/bash
# Felix E. Klee <felix.klee@inka.de>
MSLINK=mslink_v1.3.sh
DROPBOX_DIR="/mnt/c/Users/Felix/Dropbox"
DROPBOX_WIN_DIR='C:\Users\Felix\Dropbox'
HOME_DIR="/home/felix"
HOME_WIN_DIR='\\wsl.localhost\Ubuntu\home\felix'
@feklee
feklee / lnk2desk
Last active November 23, 2023 07:26
Creates link to DIR on Windows desktop. Only works for certain directories inside my Linux virtual machine.
#!/bin/bash
# Depends on:
#
# * Mikaël Le Bohec's [mslink][1], and
#
# * my [winpath][2].
#
# [1]: http://www.mamachine.org/mslink/index.en.html
# [2]: https://gist.github.com/feklee/678c630aa7f84ceda1c766333b37e7d3
@feklee
feklee / organize_media
Last active August 10, 2023 06:55
Sorts media files into directories by the date when they were created
#!/bin/bash
# Sorts media files into directories by the date when they were
# created. There is no time zone conversion: Many media files don't
# contain a time zone, or they default to UTC.
# Felix E. Klee <felix.klee@inka.de>
shopt -s nullglob
@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 <felix.klee@inka.de>
set -e
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} PGP_ENCRYPTED_PDF NEW_PDF PGP_ENCRYPTED_RESULT