Skip to content

Instantly share code, notes, and snippets.

View avhm's full-sized avatar

Anthony Hiley-Mann avhm

View GitHub Profile
@avhm
avhm / plex-inotify.sh
Created June 15, 2025 20:26
Shell script to trigger a plex library scan when files in the provided paths change. Debounced, Synology NAS compatible
#!/bin/bash
set -euo pipefail
###############################################################################
WATCH_DIRS=(/volume1/TV /volume1/Movies)
MIN_BYTES=104857600 # Minimum file size trigger
EX_RE='.*(\.part|\.!qB|\.!ut)$'
INO=$(command -v inotifywait)
FLOCK=$(command -v flock)
DEBOUNCE=20 # seconds
@avhm
avhm / index.js
Created June 15, 2022 14:26
Batch Renderer
// run as: node index.js --port=1234 --count=512 --threads=18 --res=2400
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
var argv = require("yargs/yargs")(process.argv.slice(2)).argv;
(async () => {
let maxConc = argv.threads || 4;
let mutliples = argv.count || 10;
let res = argv.scale || 2;
@avhm
avhm / collectd.log
Created March 5, 2021 16:28
collectd.log
Wed Mar 3 06:00:00 2021 daemon.err collectd[19797]: Exiting normally.
Wed Mar 3 06:00:00 2021 daemon.err collectd[19797]: collectd: Stopping 2 read threads.
Wed Mar 3 06:00:00 2021 daemon.err collectd[19797]: collectd: Stopping 5 write threads.
Wed Mar 3 06:00:00 2021 daemon.err collectd[19797]: ping plugin: Shutting down thread.
Wed Mar 3 06:00:00 2021 daemon.err collectd[19797]: exec plugin: Sent SIGTERM to 19897
Wed Mar 3 06:00:00 2021 daemon.err collectd[25365]: configfile: stat (/etc/collectd/conf.d) failed: No such file or directory
Wed Mar 3 06:00:00 2021 daemon.err collectd[25365]: plugin_load: plugin "irq" successfully loaded.
Wed Mar 3 06:00:00 2021 daemon.err collectd[25365]: plugin_load: plugin "entropy" successfully loaded.
Wed Mar 3 06:00:00 2021 daemon.err collectd[25365]: plugin_load: plugin "conntrack" successfully loaded.
Wed Mar 3 06:00:00 2021 daemon.err collectd[25365]: plugin_load: plugin "ping" successfully loaded.
@avhm
avhm / pi4.json
Created January 18, 2021 14:08
Grafana Pi4 Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@avhm
avhm / index.html
Created June 12, 2014 10:19
A Pen by Anthony Mann.
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Categories</a></li>
<li><a href="#">Blog</a></li>
</ul>
</nav>
<div class="content">
<div id="menu">Menu</div>
@avhm
avhm / Circles
Created November 17, 2013 22:16
function circles(x,y,r,g,b,a,l){
if(count % ~~(rand(1))){
return;
}
var scale1 = Math.pow(r, 3) / slider1;
var scale2 = Math.pow(g, 3) / slider2;
ctx.fillStyle = rgba(r,g,b,slider4);
@avhm
avhm / Tuesday09July2013.csv
Created July 9, 2013 20:51
3x 3rd gear runs
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 7 columns, instead of 4 in line 1.
Tuesday,09,July,2013,21:06:39:41114,VCDS Version: Release 11.11.6,Data version: 20121223
1K0 907 115 T,ADVMB,2.0l R4/4V TFSI 0010,
,,G014,F2,G015,F0,G015,F1,G015,F2,G016,F0,G031,F0,G103,F0,G115,F2,G115,F3,G143,F0,G230,F0,G230,F1,
Marker,TIME,Group 14 - Field 2,TIME,Group 15 - Field 0,TIME,Group 15 - Field 1,TIME,Group 15 - Field 2,TIME,Group 16 - Field 0,TIME,Group 31 - Field 0,TIME,Group 103 - Field 0,TIME,Group 115 - Field 2,TIME,Group 115 - Field 3,TIME,Group 143 - Field 0,TIME,Group 230 - Field 0,TIME,Group 230 - Field 1,
,STAMP,Misfire - Sum Counter,STAMP,Cylinder 1,STAMP,Cylinder 2,STAMP,Cylinder 3,STAMP,Cylinder 4,STAMP,Lambda Sensor - Current Value,STAMP,Current - Fuel Pressure,STAMP,Boost Pressure - (specified),STAMP,Boost Pressure - (actual),STAMP,Engine Speed,STAMP,Rail Pressure - (specified),STAMP,Rail Pressure - (actual),
,,,,,,,,,,,,,, bar,, mbar,, mbar,, /min,, bar,, bar,
,0.00,0,0.13,0,0.13,0,0.13,0,0.25,0,0.38,0.98,0.52,4.94,0.64,600.0,0.64,1060.0,0.77,1640,0.89,54.64,0.89,54.69,
,1.03,0
@avhm
avhm / gist:5776560
Created June 13, 2013 19:24
PlexConnect.py multiprocessor fixes for Atom Synology NAS This removes multi-processor support! But it works.
#!/usr/bin/python
"""
PlexConnect
Sources:
inter-process-communication (queue): http://pymotw.com/2/multiprocessing/communication.html
"""
@avhm
avhm / .slate
Created November 26, 2012 13:27
slate config
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config keyboardLayout querty
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
@avhm
avhm / gist:3987882
Created October 31, 2012 15:59
CanJS proposed event changes
var obs = new can.Observe({})
obs.bind('change', func) // Fires once (then, once post timeout) -> just event?
obs.delegate('*','change',func) // Fires once (then, once post timeout) -> just event?
obs.bind('changes', func) // Fires twice (then, once post timeout) -> ev, attr, how, newVal, oldVal
obs.delegate('*','changes', func) // Fires twice (then, once post timeout) -> ev, attr, how, newVal, oldVal
// Should we differentiate between change and changeds?
obs.bind('changed', func); // Fires three times post timeout -> ev, attr, how, newVal, oldVal