Skip to content

Instantly share code, notes, and snippets.

View iarp's full-sized avatar

Ian R-P iarp

  • Toronto, Ontario, Canada
View GitHub Profile
@iarp
iarp / nginxproxymanager_load_balancer.sh
Created April 14, 2026 20:22
NginxProxyManager as a load balancer configuration required
# Go to whereever "/data" is mounted localled, create/append to nginx/custom/http.conf
upstream myweb {
# ip_hash;
server 192.168.1.100:8000 weight=5 max_fails=3 fail_timeout=10s; #Nginx
server 192.168.1.101:80 weight=1 max_fails=3 fail_timeout=10s; #UM
}
# in NPM, edit the Proxy Host, Forward Hostname and port no longer matter, fill in with garbage 127.0.0.1 80
# go to the Advanced tab or the cog in the top right of the proxy host editor and add
@iarp
iarp / fix _contacts.py
Last active April 14, 2026 20:27
When moving from android to iphone and keeping Nextcloud as my calendar and contacts sync, hundreds of contacts would not sync.
import pathlib
# pip install vobject
import vobject
input_file = pathlib.Path("cache/contacts-bad.vcf")
output_file = pathlib.Path("cache/contacts-fixed.vcf")
with input_file.open() as input_fo, output_file.open('w', newline="") as output_fw:
find . -type f -exec stat --format '%A|%U:%G|%F|%n' {} \;
@iarp
iarp / stop-docker-bottom-up.sh
Created June 4, 2024 19:45
Stop unraid's docker containers bottom up.
sed '1!G;h;$!d' "/boot/config/plugins/dockerMan/userprefs.cfg" | while read line || [[ -n $line ]];
do
# do something with $line here
tmp=${line#*\"} # Remove everything up to and including first =
container_name=${tmp::-1}
echo "Stopping $container_name"
docker stop -t 30 $container_name
done
@iarp
iarp / maptimer.xml
Last active March 21, 2024 14:12
Add Guild Wars 2 Convergences to gw2taco map timer. Add the following to the end of maptimes.xml file just above </GW2MapTimer>
<Map Name="Convergence (public)" Length="180" Start="90" id="wtcon">
<Event Name="Convergence" Length="10" Color="8042C8D7"/>
<Event Name="" Length="170" Color="008AEAF4"/>
</Map>
@iarp
iarp / google crap filter.js
Created May 24, 2023 15:51
tampermonkey script that highlights geeksforgeeks, medium, and quora
// ==UserScript==
// @name Google Crap Filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Highlight bad sites in Google search results.
// @author carcigenicate
// @match https://www.google.com/search*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@iarp
iarp / owntracks python decrypt.py
Last active November 14, 2022 13:20
OwnTracks Python decrypt function
import base64
from libnacl import crypto_secretbox_KEYBYTES as KEYLEN
from libnacl.secret import SecretBox
def decrypt_payload(payload):
key = 'abcedf'.encode('utf-8')
key = key.ljust(KEYLEN, b'\0')
ciphertext = base64.b64decode(payload)
@iarp
iarp / django-admin.py
Created July 7, 2022 01:47
django model auto register
from django.apps import apps
from django.contrib import admin
from django.contrib.admin.sites import AlreadyRegistered
app_models = apps.get_app_config("app-name-here").get_models()
for model in app_models:
try:
admin.site.register(model, admin.ModelAdmin)
except AlreadyRegistered: # pragma: no cover
pass
@iarp
iarp / userChrome.css
Created April 26, 2022 00:19
firefox Tighten up drop-down/context/popup menu spacing (8 Sep 2021)
# firefox userChrome.js changes
/*** Tighten up drop-down/context/popup menu spacing (8 Sep 2021)
toolkit.legacyUserProfileCustomizations.stylesheets = True
***/
menupopup:not(.in-menulist) > menuitem,
menupopup:not(.in-menulist) > menu {
padding-block: 2px !important;
min-height: unset !important; /* v92.0 - for padding below 4px */
}
@iarp
iarp / gitea file permision correction.sh
Last active April 27, 2022 14:38
Corrects file permission issues on gitea repos after unraid newperms accidental run
cd /mnt/user/repos/
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 755 {} \;
find objects/ -type d -exec chmod 755 {} \;
find info/ -type f -exec chmod 644 {} \;
find refs/ -type f -exec chmod 644 {} \;
find objects/ -type f -exec chmod 444 {} \;
find objects/info/ -type f -exec chmod 644 {} \;
chown -R iarp:1000 ./
chmod 644 HEAD config description