Skip to content

Instantly share code, notes, and snippets.

View ktemkin's full-sized avatar

Kate Temkin ktemkin

View GitHub Profile
@ktemkin
ktemkin / quote-for-nixos.xsh
Created May 3, 2024 14:52
hack to let you use unquoted flake attr refs in xonsh
""" Input transformer that automatically quotes mid-word #s for e.g. nix. """
from xonsh.events import events
@events.on_transform_command
def _autoquote_for_nix(cmd):
new_command = []
# Process each word individually.
words = cmd.strip().split(" ")
#!/usr/bin/env python2.7
import asyncore
import evdev
import signal
import re
#Stores the product names for each device which can be used as a vim-clutch.
COMPATIBLE_NAME_REGEX = "RDing FootSwitch.*";
@ktemkin
ktemkin / maschine_mk3.md
Created May 18, 2023 00:26
Maschine Mk3 RE Notes

Display Format

The device has a "vendor defined interface" (5) with a single bulk OUT endpoint (4). This accepts commands that will set the screen value, with the following format:

Byte Meaning
0 const 0x84, command
1 const 0x00
2 screen number; 0 for left, 1 for right
3 const 0x60
@ktemkin
ktemkin / roli_fw_extract.py
Created April 29, 2023 07:03
WIP script to unpack Roli firmware files
#!/usr/bin/python3
import math
import mido
FIRMWARE_IN = "firmware.syx"
FIRMWARE_OUT = "firmware.bin"
FIRMWARE_PUSH_COMMAND = 0x04
@ktemkin
ktemkin / default.nix
Last active August 23, 2024 17:38
scopehal derivation + dependencies
#
# scopehal apps, including glscopeclient and optionally ngscopeclient
#
# vim: et:ts=2:sw=2:
#
{ pkgs, lib, cmake, pkg-config, patchelf, ... }:
let
ffts = (pkgs.callPackage ./ffts.nix { });
vulkan-sdk = (pkgs.callPackage ./vulkan-sdk.nix { });
in
@ktemkin
ktemkin / set_gerrit_font.js
Last active November 11, 2021 06:25
user script body to set Gerrit fonts
// ==UserScript==
// @name Gerrit Fonts
// @namespace https://gerrit.YOURDOMAINHERE.com
// @match https://gerrit.YOURDOMAINHERE.com/*
// ==/UserScript==
'use strict';
(function() {
-- Get the basic systems we'll want to work with.
player = Game.GetPlayer()
scriptables = Game.GetScriptableSystemsContainer()
transaction = Game.GetTransactionSystem()
equipment = scriptables:Get(CName.new("EquipmentSystem"))
-- Get data for the player.
player_data = equipment:GetPlayerData(player)
-- Hack: we need the second internal entry with the same name; so we'll create our own entry pointing to the new function.
@ktemkin
ktemkin / lamp-control.py
Created November 18, 2020 00:24
Working mockup for controlling a JOOFOO lamp with the YS1.
#!/usr/bin/env python3
"""
Silly YS1 mockup of an interface for the JOOFOO remote-controlled lamp.
"""
import sys
import argparse
# Normally, we'd just import *, but rfcat likes to do things like export functions called str(),
# so we'll be a bit more selective.
#!/usr/bin/env python2.7
# public domain-y, Kate Temkin, 2015
import asyncore
import evdev
import signal
import re
#Stores the product names for each device which can be used as a vim-clutch.
COMPATIBLE_NAME_REGEX = "RDing FootSwitch.*";
# Devices would be created by providing a core set of necessary
# information (e.g. PHY connections, clock domains, etc).
device = USBSuperSpeedDevice(pipe_bus=phy_connection, [...])
m.submodules.usb_controller = device
# Create hardware to handle standard requests on ep0. This object
# would provide methods for attaching e.g. class / vendor request handlers.
ep0 = device.create_control_endpoint(descriptors=my_descriptors)
# Endpoints will be added by calling factory methods that will