Skip to content

Instantly share code, notes, and snippets.

View ian-h-chamberlain's full-sized avatar
🏔️

Ian Chamberlain ian-h-chamberlain

🏔️
View GitHub Profile
@ian-h-chamberlain
ian-h-chamberlain / wezterm-keyhelper.lua
Last active April 21, 2025 01:06
Helper function to abbreviate wezterm key definitions
local function keys(tbl)
local result = {}
for k, act in pairs(tbl) do
local mods, last
for key in k:gmatch('([^-]+)') do
if last then
if mods then
mods = mods .. '|' .. last
else
mods = last
@ian-h-chamberlain
ian-h-chamberlain / 15-direnv.fish
Last active March 11, 2025 04:30
Direnv helper to load extra nixpkgs into the environment
if upfind .envrc >/dev/null; and command -q direnv; and not set -q DIRENV_DIR
# Do an early load of env vars so that things like XDG_DATA_DIRS can take effect
direnv export fish | source
# Then re-exec fish for $__fish_data_dir/config.fish to pick up the vars
# https://fishshell.com/docs/3.7/language.html#configuration-files
# So far this seems to be the only option to pick up .direnv/ files...
exec fish
# TODO: PWD var hook to exec again for unsetting XDG_DATA_DIRS
# Possible inspiration: https://github.com/direnv/direnv/issues/73#issuecomment-747646730
@ian-h-chamberlain
ian-h-chamberlain / .gitconfig
Last active February 27, 2025 05:16
custom sorting git branches
[alias]
# this is gnarly but it's based on the hardcoded upstream default:
# https://github.com/git/git/blob/08bdfd453584e489d5a551aecbdcb77584e1b958/builtin/branch.c#L386
# The idea is to add a field for commit date and another for a "known prefix", which sort -k can use
# I wodner if this is worth breaking out into its own helper script (git-br) instead
br = "git branch --color --format '%(committerdate:unix)'\t'%(if:equals=refs/heads/test)%(refname:rstrip=-3)%(then)1%(else)0%(end)'\t'%(HEAD) %(if)%(HEAD)%(then)%(color:green)%(else)%(color:normal)%(end)%(refname:short)' | sort -r -n -k 2 -k 1 | cut -d \t -f3"
@ian-h-chamberlain
ian-h-chamberlain / remove_less_equal.py
Created May 15, 2024 19:43
fontforge remove `less_equal.alt` lookup
#!/usr/bin/env fontforge
import sys
import fontforge
def main():
for font_name in sys.argv[1:]:
font = fontforge.open(font_name)
@ian-h-chamberlain
ian-h-chamberlain / README.md
Last active December 30, 2023 01:44 — forked from majal/minterpolate
Multi-threaded minterpolate in ffmpeg

Example command

cd ~/Movies/Wallpapers
./minterpolate.sh -r 240 -s '11:48' -t '12:08' -i Morphys_World.webm test.mov
@ian-h-chamberlain
ian-h-chamberlain / lnav-nginx-netdata.json
Created December 20, 2023 14:44 — forked from notyal/lnav-nginx-netdata.json
lnav log format definition for NGINX access.log (netdata vhost format) and NGINX error.log
{
"nginx_access_log" : {
"title" : "NGINX NetData Access Log",
"description" : "NGINX NetData Access Log Format",
"url" : "https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/web_log/web_log.conf",
"multiline" : false,
"regex" : {
"netdata_vhost" : {
"pattern" : "(?P<host>[a-zA-Z\\d.-_\\[\\]]+)\\s+(?P<server_port>\\d+)\\s+(?P<remote_addr>[\\da-f.:]+)\\s+[\\w\\.\\-]+\\s+(?<remote_user>\\S+)\\s+\\[(?<timestamp>[^\\]]+)\\]\\s+\"(?:\\-|(?<request>\\w+) (?<request_uri>[^ \\?]+)(?:\\?(?<request_uri_query>[^ ]*))? (?<request_version>[\\w\\\/\\.]+))\"\\s+(?P<status>[1-9]\\d{2})\\s+(?P<body_bytes_sent>\\d+)\\s+(?P<request_length>\\d+)\\s+(?P<request_time>\\d+(?:.\\d+)?)\\s+(?:\\-|(?P<upstream_response_time>\\d+(?:.\\d+)?))\\s+\"(?<http_referer>[^\"]+)\"\\s+\"(?<http_user_agent>[^\"]+)\""
}
@ian-h-chamberlain
ian-h-chamberlain / player_movement2.rs
Created August 28, 2022 17:15
bevy_rapier2d add children example
use bevy::prelude::*;
use bevy_rapier2d::prelude::*;
fn main() {
App::new()
.insert_resource(WindowDescriptor {
title: "Player Movement Example".to_string(),
width: 1000.0,
height: 1000.0,
..Default::default()
@ian-h-chamberlain
ian-h-chamberlain / console.log
Last active February 1, 2019 19:32
Cpu profile for unresponsive vscodevim.vim
extensionHost.ts:329 [Extension Host] debugger listening on port 9837
extensionHost.ts:235 Extension Host
extensionHost.ts:236 Debugger listening on ws://127.0.0.1:9837/f82cb762-d8df-4b2a-bf57-1f9efb05d6d0
For help see https://nodejs.org/en/docs/inspector
log.ts:157 INFO no standard startup: not a new window
console.ts:134 [Extension Host] Configuration: debug: 0 errors found with vim configuration
console.ts:134 [Extension Host] Extension Startup: debug: Start
console.ts:134 [Extension Host] ModeHandler: debug: handling key=<ExtensionEnable>.
console.ts:134 [Extension Host] Remapper: debug: trying to find matching remap. keys=<ExtensionEnable>. mode=Normal. keybindings=normalModeKeyBindingsMap.