Skip to content

Instantly share code, notes, and snippets.

@tohuw
tohuw / Sublime 3 Config
Last active October 7, 2016 18:08
My Sublime Text 3 Config
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 500,
"auto_indent": true,
"auto_match_enabled": true,
"binary_file_patterns":
[
"*.woff",
"*.eot",
"*.ttf",
@tohuw
tohuw / Fun with 'Find'
Last active August 29, 2015 14:15
Fun with 'Find'
#! /bin/bash
## Fun with 'Find':
## A small collection of one-liners demonstrating the power of find.
# Find all files larger than a given size
find /foo/bar -type f -size +1024k
# Recursively rename files matching a pattern
find -name '*.JPG' -exec rename .JPG .jpg {} \;
# jekyll-readtime
# 2015 Ron Scott-Adams, Licensed under MIT:
# https://tldrlegal.com/license/mit-license
# Original work: https://gist.github.com/zachleat/5792681
# Outputs the estimated time the average person might take to read the content.
# 200 is a round figure based on estimates gathered from various studies.
# http://www.ncbi.nlm.nih.gov/pubmed/18802819
# Usage: {{ page.content | readtime }}
"*":
"exception-reporting":
userId: "fcfca3bd-4ecf-a3fe-00d2-f35a2ce52b59"
welcome:
showOnStartup: false
core:
audioBeep: false
projectHome: "/Users/tohuw/Projects"
themes: [
"unity-ui"
@tohuw
tohuw / material-design-colour-palette-variables.scss
Last active August 29, 2015 14:26
Material Design colour palette made into Sass variables.
// Material Design Colour Palette
// by Brandon Himpfen http://www.himpfen.com/
// Red
$md-red-50: #ffebee;
$md-red-100: #ffcdd2;
$md-red-200: #ef9a9a;
$md-red-300: #e57373;
$md-red-400: #ef5350;
$md-red-500: #f44336;
[CmdletBinding (SupportsShouldProcess = $false)]
param (
$Mailboxes = @(),
[switch]$FormatTable = $true
)
begin {
$MailboxesLocationsPermissions = @()
$LocationsPermissions = @()
}
// A demonstration of how to write SASS styling for multi-level lists
// List types vary per level, and list counters are styleable
// Owes greatly to this: http://stackoverflow.com/a/15253672/316733
ol {
counter-reset: li;
margin-left: .5em;
li {
counter-increment: li;
@tohuw
tohuw / agent-commit-provenance-prompt.md
Created July 31, 2026 01:20
Prompt for any coding agent: enforce Model:/Host: provenance trailers on AI-agent git commits

Prompt: record AI-agent provenance on every git commit

Copy everything below into your coding agent (Claude Code, Codex, or any other) on the machine you want covered.


Set up this machine so that every git commit made by an AI agent automatically records which model was active and which machine it was made from, as commit-message trailers:

Model: 
@tohuw
tohuw / spotlight-fixer
Created August 20, 2026 15:33
macOS Spotlight and Launch Services fixer
#!/usr/bin/env bash
set -u
readonly SCRIPT_NAME="spotlight-fixer"
readonly LSREGISTER="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"
usage() {
cat <<'EOF'
Usage:
@tohuw
tohuw / plex-desktop-hevc-stalls-at-position-zero.md
Last active August 22, 2026 21:02
Plex Desktop for Windows: HEVC playback stalls at position 0 with no error. Narrowed to the D3D11 hardware-surface handoff in Plex's bundled mpv 0.38.0 / libplacebo v6.338.2 - stock mpv of the same version renders fine in all 8 configurations. Includes the one-line workaround, benchmarks, and why swapping libmpv-2.dll cannot work.

Plex Desktop for Windows: HEVC playback stalls at position 0, forever, with no error

Conclusion: the fault is in Plex's build combination, not in any upstream component. Every upstream ingredient — mpv, libplacebo, the D3D11 hardware path, window embedding — works correctly when assembled the way upstream assembles it. Only Plex's assembly fails.

Workaround: one line, and it measures faster than the hardware path it replaces. Date: 2026-08-22