Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
threedaymonk / 90-kensington-expert-mouse.hwdb
Last active November 9, 2023 12:43
Swap buttons 3 and 4 on Kensington Expert Mouse trackball in Wayland
# /etc/udev/hwdb.d/90-kensington-expert-mouse.hwdb
evdev:input:b*v047Dp1020*
KEYBOARD_KEY_90004=btn_middle
KEYBOARD_KEY_90003=btn_side
#!/usr/bin/env ruby
require 'csv'
require 'date'
output = CSV.new($stdout)
CSV.parse(ARGF.read.strip, headers: true).each do |row|
case row['Date']
when 'Today'
date = Date.today
use_bpm 80
$t0 = Time.now
def elapsed
Time.now - $t0
end
def converge(period)
t = elapsed
@threedaymonk
threedaymonk / stats.rb
Created May 18, 2022 14:32
Analyse directories of films by quality
Film = Struct.new(:path, :w, :h, :size) do
def pixels
w * h
end
end
films = []
Dir['*'].each do |dir|
next unless File.directory?(dir)
@threedaymonk
threedaymonk / 00README.md
Created November 8, 2021 00:18
disquiet0514
@threedaymonk
threedaymonk / instructions.md
Last active July 4, 2020 11:47
Arduino IDE removal

How I worked out what the Arduino IDE was doing

Wrap each avr toolchain binary with a script that spies and reports on its command line arguments:

cd arduino-1.8.13/hardware/tools/avr
mv bin bin.real
mkdir bin
cd bin
cp path/to/wrapper .

chmod +x wrapper

@threedaymonk
threedaymonk / detect.py
Created January 14, 2020 14:42
Python barcode reader example
#!/usr/bin/python3
from imutils.video import VideoStream
from pyzbar.pyzbar import decode
from pprint import pprint
import cv2
import time
vs = VideoStream(src=0).start()
time.sleep(1.0)
@threedaymonk
threedaymonk / format.md
Last active September 27, 2023 12:42
Roland SP-404SX sample format

Roland SP-404SX sample file format

Notes

Field types are marked using C-style notation:

  • char[4] indicates a 4-byte fixed-width string
  • uint[6] indicates a 6-byte sequence
  • uint8, uint16, and uint32 are unsigned byte, short, and long integers
  • int8, int16, and int32 are signed byte, short, and long integers
@threedaymonk
threedaymonk / sysex.md
Last active June 18, 2021 22:09
Novation Launch Control Sysex

General

All sysex messages start with

Hex Field
F0 Start sysex
00 20 29 Manufacturer: Novation
02 Product type
0A Product ID
@threedaymonk
threedaymonk / post-install.sh
Last active December 31, 2019 23:12
Ubuntu post-install packages
#!/bin/bash
sudo apt update
sudo apt install -y \
apt-file \
autoconf \
bison \
build-essential \
checkinstall \