Skip to content

Instantly share code, notes, and snippets.

View akingdom's full-sized avatar

Andrew Kingdom akingdom

  • Australia
View GitHub Profile
@akingdom
akingdom / setuplocalai.bat
Created October 6, 2026 18:54
Setup limited local Windows AI - be sure to customise defaults
@echo off
:: Ensure admin rights
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo [ERROR] This script must be run as an ADMINISTRATOR.
echo Please right-click this batch file and select "Run as Administrator".
pause
exit /b
)
@akingdom
akingdom / colorConversion-simple.js
Last active September 26, 2026 11:32
Converts colours between web hex color and an RGBA object.
// Javascript
// Color from a web-style hex string -- for named colors, see https://gist.github.com/akingdom/0a0edd3ea37a9a331983cff3a69c4bee
// By Andrew Kingdom
// MIT license (use free and do not remove this author's name, etc)
//
// **Supported string formats**:
// - `"fff" // RGB`
// - `"#fff" // #RGB`
// - `"ffff" // RGBA`
// - `"#ffff" // #RGBA`
@akingdom
akingdom / LP-GB-MIDI-Event-List-Data-Reference.md
Created August 6, 2026 14:01
Logic Pro / GarageBand User Guide: Event List Data Reference

Logic Pro / GarageBand User Guide: Event List Data Reference

This guide details the procedures for extracting raw event parameters from your project and defines each data column using official Apple interface specifications.


Copying Event Data from the Editors Workspace

To copy MIDI events as tab-delimited text from your project (GarageBand):

@akingdom
akingdom / bbedit_grep_patterns_ak.md
Last active August 3, 2026 14:47
Grep patterns I find useful.

BBEdit Grep Patterns

Author: Andrew Kingdom Note: These are grep patterns I find useful for the BBEdit text editor on MacOS. Some templates may need modification/changes before use on your specific data.

  • Remove Blank Lines

    • Find: ^\s*$\n
    • Replace: (empty string)
  • Pascal Comment to C Comment

  • Find: {([^}]*)}

@akingdom
akingdom / callback1.js
Last active August 3, 2026 14:38
Demonstrates callback from a class method
//application/javascript
//
// Demonstrates callback from a class method
// By Andrew Kingdom
// MIT license
// Define a class
let MyClass1 = class {
constructor(initialValue) {
this.prop = initialValue; // store the parameter value in a property
@akingdom
akingdom / max_upload_size.php
Last active August 3, 2026 14:38
Returns the minimum download limit specified in the current php.ini file.
// Returns the minimum download limit specified in the current php.ini file.
//
// By Andrew Kingdom
// MIT license
function max_upload_size() {
$max_size = PHP_INT_MAX;
$post_overhead = 2048; // Reserve 2k for non-file data in the POST.
$tmp = shorthand_bytes(ini_get('upload_max_filesize'));
@akingdom
akingdom / upload.php
Last active August 3, 2026 14:37
An example of receiving file(s) POSTed by an HTML web form (PHP language)
<?php
// An example of receiving file(s) POSTed by an HTML web form (PHP language)
//
// Please add any necessary path and file handling, security, etc. that you require.
//
// By Andrew Kingdom
// MIT license
//
@akingdom
akingdom / !Line Record Format.md
Last active May 31, 2026 14:28
A very simple human-friendly parsable data format. I use this in a number of projects.

Line Record Format (LRF) Specification

1. Introduction

The Line Record Format (LRF) is a human-friendly, line-oriented data format designed for simplicity of both human editing and machine parsing. Every LRF document is also a valid Markdown document, making it suitable for embedding structured data in plain-text documentation.

2. Format Objectives

@akingdom
akingdom / PLY file format + notes.md
Last active December 26, 2025 06:02
This document presents the PLY polygon file format, a format for storing graphical objects that are described as a collection of polygons.
@akingdom
akingdom / pathGetter.js
Created August 8, 2025 15:04
High-performance, hybrid property accessor for dot-delimited paths.
// pathGetter.js - MIT License (C) 2025 Andrew Kingdom
/**
* createPathGetter
* ----------------
* Returns a high-performance, hybrid property accessor for dot-delimited paths.
*
* DESIGN:
* - Cold paths (below `threshold` calls) use a manual string parse to avoid `.split()` allocations.
* - Hot paths (≥ `threshold` calls) are promoted to precompiled accessors and cached for speed.
* - Cache is capped (`maxCacheSize`) and evicts oldest hot paths (FIFO) to control memory growth.