Skip to content

Instantly share code, notes, and snippets.

View rikmeijer's full-sized avatar

Rik Meijer rikmeijer

View GitHub Profile
@rikmeijer
rikmeijer / gist:395a3c079a7be7ba0a3d043846072300
Created August 14, 2025 13:26
generate-nextcloud-release
#!/bin/sh
# Based on instruction at https://nextcloudappstore.readthedocs.io/en/latest/developer.html
# Call ./generate-nextcloud-release <APP_ID>
# Assuming app is in folder <APP_ID>
# and assuming signing key is in ~/.nextcloud/certificates/<APP_ID>.key
tar --exclude=".git*" -czf $1.tar.gz noxtr
openssl dgst -sha512 -sign ~/.nextcloud/certificates/$1.key $1.tar.gz | openssl base64
#!/bash/sh
for dir in ./*/
do
dir=${dir%*/}
album="${dir##*/}"
docker run -it -d --name "upload_${album//[^0-9a-zA-Z]/_}" -v "$(pwd)":/import:ro -e IMMICH_INSTANCE_URL=https://<IMMICH_DOMAIN>/api -e IMMICH_API_KEY=API_KEY_HERE ghcr.io/immich-app/immich-cli:latest upload --album --concurrency 5 --recursive ${album}
done
@rikmeijer
rikmeijer / checksum-trigger.php
Created June 13, 2025 11:24
Trigger checksum generator in Nextcloud, remotely
<?php
/**
* This script uses "sabre/dav" Client to make webdav requests to a Nextcloud instance.
* The "nextcloud-checksum-update" option is a, somewhat, hidden feature in the Sabre Connector (Checksum Update Plugin)
* https://github.com/nextcloud/server/blob/master/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php
*
* The basic flow is:
* - PROPFIND on /remote.php/dav/Photos (explicitly asking for '{http://owncloud.org/ns}checksums' property)
* - use the proper hash from the response
@rikmeijer
rikmeijer / nostr-proof
Last active November 18, 2024 07:29
nostr-proof
Verifying that I control the following Nostr public key: npub1efz8l77esdtpw6l359sjvakm7azvyv6mkuxphjdk3vfzkgxkatrqlpf9s4
@rikmeijer
rikmeijer / Application.php
Last active February 22, 2024 15:12
Potential fix for #nextcloud/social/issues/1864
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
@rikmeijer
rikmeijer / security.sql
Created January 26, 2021 15:23
Create webdav with mysql authentication and bcrypt encryption
CREATE TABLE users (
username VARCHAR(255) NOT NULL,
password VARCHART(255) NOT NULL, -- bcrypt, column width is not optimized
realm VARCHAR(255) NOT NULL DEFAULT 'rikmeijer.nl',
PRIMARY KEY (username),
UNIQUE (username, realm)
);
@rikmeijer
rikmeijer / mysql
Created June 29, 2020 08:07
Daily mysql cron dumping all tables, except for information_schema. Writing backups to /var/backups/mysql.
#!/bin/sh
/usr/bin/find /var/backups/mysql/* -mtime +7 -exec rm {} \;
for DB in $(mysql -e 'show databases' -s --skip-column-names); do
if [ "$DB" = "information_schema" ]
then
echo Skipping $DB
continue
fi
echo -n Dumping $DB...
/usr/bin/mysqldump --add-drop-database --add-drop-table --single-transaction --routines --triggers $DB | gzip > "/var/backups/mysql/$DB-$(date '+%Y%m%e').sql.gz";
c4820dc0c242e7456a1e31ca466c815829bc85235eed13c708f20d961d1fec7ecc039aaa4ade427cf46352702ef3147c1be546fc46a3e9aa7d4e690ae178dd18
@rikmeijer
rikmeijer / Main.java
Created May 15, 2019 09:18
PROG4_Wk4b
package PROG4_WK4b;
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class Main extends Application {
@rikmeijer
rikmeijer / Main.java
Created May 8, 2019 09:37
PROG4_Wk3b
package PROG4_WK3b;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;