Skip to content

Instantly share code, notes, and snippets.

@rolfen
rolfen / archive.bash
Last active February 29, 2024 11:49
Extract previews and metadata from original photos and videos. Archive and backup.
#!/bin/bash
# Import and organize into subfolders by date taken (YYYY/MM/DD)
scriptname=`basename "$0"`
if [[ $# -ne 2 ]]; then
echo "Usage: $scriptname /source/dir /archive/dir"
else
(cd "$2"; exiftool -progress -ext MTS -ext ARW -ext ORF -ext xmp -r -m -d %Y/%m/%d "-Directory<DateTimeOriginal" "$1")
@rolfen
rolfen / _README.md
Last active April 9, 2021 05:33
Resume a dd operation with a check

This little script resumes an interrupted dd copy at a given offset.

Before resuming, it rolls back (the amount of roll-back is OVERLAP_SIZE * CHUNK) then calculate the checksum of the overlap on both files to make sure that they are valid images of each other.

The checksums have to be checked manually by the operator (todo: automate).

Setting up multiple user write permission to WWW directory

addgroup www-admin
adduser joe
adduser www-admin joe
setfacl -R -m g:www-admin:rwx /var/www
setfacl -R -m -d g:www-admin:rwx /var/www
chmod -R g+s /var/www
@rolfen
rolfen / CheatCheet.md
Last active February 4, 2021 20:43
MyArchive

Warning These are for educative purposes (examples, tips, etc.). Do not blindly execute them.

Fix double separator in hash-file (double or more space -> single space)

cat meta/hash-file.list | sed -E 's/^(\S+)\s{2,}(\S.+)$/\1 \2/'

Fix windows newlines in file

@rolfen
rolfen / ADB_remote_wifi.md
Last active May 8, 2025 20:28
Remote (wifi) control your android device through ADB

You will need to connect your phone first, using USB.

With the USB cable:

adb tcpip 5555

Find out the IP address of your phone

@rolfen
rolfen / DeutscheWörter.md
Last active January 24, 2021 09:26
German Words
De En
störrischer stubborn
bemühunngen efforts
vorübergehend temporarily
verdrangen to displace
Einschätzung assessment
fällig due
Gegenstand object
Reichweite reach
@rolfen
rolfen / EMAIL.md
Last active August 18, 2018 13:27
Setting up a Linux server
@rolfen
rolfen / MySqlExportBlob.md
Last active May 22, 2019 10:41
Exporting multiple blobs/images from an SQL database

Exporting multiple blobs from an SQL database.

This is tested for MySQL with Linux or OSX

I was in a situation where I had images saved into an SQL table, as "blobs" and needed to export them into proper jpg files.

This relies on the SQL syntax SELECT INTO DUMPFILE. However this command can only export one row at a time.

1. Get the IDs of the rows we want to export

@rolfen
rolfen / 00 Ideas and notes
Last active August 24, 2023 23:45
Ideas and notes
Related to Linux
@rolfen
rolfen / gist:c57e4606856f900c654fabb5cf9a34b6
Last active February 20, 2018 15:42
Weston dropdown positioning bug
Sometimes drop-down or contextual menus appear at the wrong position on the screen.
Upon moving the parent window, it appears that the menu position is not updated. They still appear at the same position.
To reproduce with affected applications, open app, open drop-down menu, move app window, open same drowpdown menu - observe that the menu has not moved with the window and is subsequently now appearing at a wrong position.
If the window is resized, the menus get re-aligned.
Weston 3.0.0
(running in DRM mode)
There is such a bug in sway too. But over there it seems to affect everything (pcmanfm, lxterminal, subl, chromium...)