Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / bit-string-encoding.js
Last active January 1, 2024 17:41
bit-string-encoding.js
View bit-string-encoding.js
// https://codesandbox.io/s/bit-string-compression-zydb3?file=/src/App.js
const name = 'test_example'
const width = 48
const height = 48
const arr = [
0xffffff000000,
0x8000017ffffe,
0xbffffd400002,
0xa00005400002,
@cowboy
cowboy / cowboy-akai-force-rec-pedal-matrix.ino
Last active September 20, 2023 05:43
Akai Force Rec Pedal w/ 8x8 Matrix Display (USB MIDI) - for Teensy LC
View cowboy-akai-force-rec-pedal-matrix.ino
// ===============================================================
// Akai Force Rec Pedal w/ 8x8 Matrix Display (USB MIDI) - for Teensy LC
// "Cowboy" Ben Alman, 2021
// https://gist.github.com/cowboy/6c2230d54aea58577c5b7953ea86aebe
// ===============================================================
// Why does this exist?
//
// I designed this to circumvent an issue with the Akai Force where receiving
// an MMC Rec message signals that the loop should end at the end of the
@cowboy
cowboy / cowboy-akai-force-rec-pedal.ino
Last active September 28, 2021 04:57
Akai Force Rec Pedal (USB MIDI) - for Teensy LC
View cowboy-akai-force-rec-pedal.ino
// ===============================================================
// Akai Force Rec Pedal (USB MIDI) - for Teensy LC
// "Cowboy" Ben Alman, 2021
// https://gist.github.com/cowboy/5ad43d0d369c79b6d6538f076698e17a
// ===============================================================
// Why does this exist?
//
// I designed this to circumvent an issue with the Akai Force where receiving
// an MMC Rec message signals that the loop should end at the end of the
@cowboy
cowboy / delayed-mmc-rec.ino
Last active September 15, 2021 18:46
USB MIDI Delayed MMC Rec (Teensy LC)
View delayed-mmc-rec.ino
// =======================================================
// USB MIDI Delayed MMC Rec - for Teensy LC
// "Cowboy" Ben Alman, 2021
// =======================================================
// What does it do?
//
// This USB MIDI device toggles recording via MMC Rec message, but instead of
// sending the MMC Rec message immediately, it sends the message at the end of
// the current measure.
@cowboy
cowboy / border-filter.hlsl
Last active September 7, 2021 01:30
Draw a border around a source - For use as a filter with StreamFX in OBS Studio
View border-filter.hlsl
// ===============================================================
// Draw a border around a source
// For use as a filter with StreamFX in OBS Studio
// ===============================================================
// "Cowboy" Ben Alman - 2021
// https://gist.github.com/cowboy/9b33aed126b78f60ca8c126567625fc9
// ===============================================================
// See https://github.com/Xaymar/obs-StreamFX/wiki/Source-Filter-Transition-Shader
uniform float4x4 ViewProj<
@cowboy
cowboy / starship.toml
Created May 19, 2021 13:54
My current starship config
View starship.toml
[time]
disabled = false
[status]
disabled = false
map_symbol = true
symbol = "✖ "
not_executable_symbol = " "
not_found_symbol = " "
sigint_symbol = " "
@cowboy
cowboy / midi-merge.c
Created October 20, 2020 21:48
MIDI Merge for ATmega4809 (Curiosity Nano)
View midi-merge.c
/*
* MIDI Merge for ATmega4809
* Copyright (c) 2020 Benjamin Alman
* MIT License
*/
#include <MIDI.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, midi_1);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, midi_2);
@cowboy
cowboy / .gitignore
Created September 30, 2020 17:57
kicad gitignore
View .gitignore
# Adapted from:
# https://github.com/github/gitignore/blob/master/KiCad.gitignore
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
# Format documentation: http://kicad-pcb.org/help/file-formats/
# Temporary files
*.000
*.bak
*.bck
@cowboy
cowboy / bom.ini
Last active September 30, 2020 00:16
generate boms: combine 1 or more KiBoM generated csv files with an id column name like "Digikey" (where a digikey part number is stored) and output IMO a much better csv file (note: do NOT number rows or group fields)
View bom.ini
; https://github.com/SchrodingersGat/KiBoM
;
[BOM_OPTIONS]
; General BoM options here
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 1
; If 'html_generate_dnf' option is set to 1, also generate a list of components not fitted on the PCB (HTML only)
html_generate_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
@cowboy
cowboy / unicornhd-animated-gif.py
Created August 4, 2020 16:34
animated gif viewer for UnicornHD
View unicornhd-animated-gif.py
#!/usr/bin/env python3
'''
See
https://github.com/HimbeersaftLP/unicorn-hat-hd-gif-displayer/blob/master/unicorn-gif.py
'''
import signal
import time
from sys import exit