Skip to content

Instantly share code, notes, and snippets.

@maxkagamine
maxkagamine / Program.cs
Created July 16, 2022 04:41
C# 9 Record Types: Automatic Modified Date
using System;
var foo = new Foo("foo");
var bar = foo with { Name = "bar" };
Console.WriteLine(foo);
Console.WriteLine(bar);
// Foo { CreatedOn = 7/15/2022 21:39:43, UpdatedOn = , Name = foo }
// Foo { CreatedOn = 7/15/2022 21:39:43, UpdatedOn = 7/15/2022 21:39:43, Name = bar }
@maxkagamine
maxkagamine / backup_flash_and_appdata.sh
Last active June 28, 2023 01:34
Unraid user script to create backups of the flash drive and appdata on a schedule. An email is sent with the full command output if the cronjob fails.
#!/bin/bash
#name=Backup flash and appdata
#description=Creates tarballs of the flash drive and appdata share.
#argumentDescription=Backup directory
#argumentDefault=/mnt/user/Backup/Sovngarde
#arrayStarted=true
#noParity=true
#clearLog=true
set -eo pipefail
shopt -s extglob
@maxkagamine
maxkagamine / Known folder.reg
Last active April 20, 2023 12:42
Recycle Bin can be enabled on a mapped network drive by defining a Known Folder in the registry. (Also a way to create custom user folders. For adding folders to This PC, though, it seems you need to create a CLSID entry instead; use Winaero Tweaker for that.)
Windows Registry Editor Version 5.00
; For folder icons, set folder to read-only and create a desktop.ini set to
; read-only|system|hidden with contents:
; [.ShellClassInfo]
; IconResource=C:\Path\To\Icon.ico,0
; Remember to change the guid for each known folder:
; https://www.guidgenerator.com/
@maxkagamine
maxkagamine / Nginx & certbot on Unraid.md
Last active March 9, 2024 09:01
Guide to running an nginx reverse proxy on Unraid with a Let's Encrypt wildcard cert, using the official nginx and certbot Docker images.

Nginx & certbot on Unraid

Here's a guide to running an nginx reverse proxy on Unraid with a Let's Encrypt wildcard cert (which can cover the Unraid web gui too), using the official nginx and certbot Docker images.

Other options:

  • caddy — popular nginx alternative with built-in automatic Let's Encrypt
  • pomerium — all-in-one reverse proxy, SSL, and OAuth-based login (compare to Caddy Security)
  • nginx-certbot — parses your nginx configs and manages certbot for you (see the original version of this gist for a script to copy your cert to Unraid)
  • swag — used to be called letsencrypt; has other things in it like PHP & f

How to install GNU Stow on Unraid

Unraid OS ≥6.11.0

  1. Install the User Scripts (Andrew Zawadzki) plugin from CA
  2. cat /etc/slackware-version and check which Slackware version the current Unraid OS is based on
    • 6.11.0 ⇒ Slackware 15
  3. Head to packages.slackware.com, filter Release to Slackware64 + that version, and search for the following packages:
    • gc
  • guile
@maxkagamine
maxkagamine / batch_rename_mmd_models.py
Last active March 23, 2022 07:32
Blender addon to rename selected MMD models' armature, mesh, and materials to match the name of the empty. https://twitter.com/maxkagamine/status/1380531111906869248
# MIT License
#
# Copyright (c) 2021 Max Kagamine
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: