Skip to content

Instantly share code, notes, and snippets.

@ohsix
ohsix / buttons.cpp
Created May 26, 2024 04:23
frame based button thing, inspired by the quake 3 input code
#include <Arduino.h>
#include "buttons.h"
struct buttonState buttonState[2];
void buttonsBegin()
{
uint8_t buttons = sizeof(buttonState) / sizeof(buttonState[0]);
for(int i = 0; i < buttons; i++)
@ohsix
ohsix / rtl_fw.ksy
Created July 29, 2022 04:40
realtek fw decoder
# only checked w/ rtl8168e-3.fw
# there are firmware with and without a magic number
# this also doesn't check the validity of the check byte
meta:
id: rtl_fw
file-extension: fw
endian: le
instances:
@ohsix
ohsix / ian.csv
Last active December 5, 2021 04:53
URBINA IAN entries from the ASCAP catalog
Title RoleType Name Shares Note
THE LONE PATROL - VOCAL VERSION (FEAT. K. SP W URBINA IAN
TSUKAMORI W URBINA IAN
A BETTER WORLD W URBINA IAN
A BLUE CANVAS W URBINA IAN
A CALL FOR JUSTICE W URBINA IAN
A COMPLICATED PLACE W URBINA IAN
A DESOLATE PING W URBINA IAN
A DYSTOPIAN PLACE W URBINA IAN
A FEW HOURS OF SLEEP W URBINA IAN
@ohsix
ohsix / zoe-bee-appreciation
Created July 23, 2021 21:31
zoe bee is on the internet
they seem nice
typedef struct _segment {
float x0, y0;
float x_step, y_step;
int num_leds;
} led_segment;
typedef struct _element {
int num_segments;
int total_leds;
float width;
@ohsix
ohsix / things
Created October 31, 2019 06:13
obscure things found in weird places
if you come upon this we were probably looking at the guts of the same thing, get in touch
tombrady5rings
@ohsix
ohsix / sketch
Created October 3, 2019 19:59
scanner head stuff
#include <Arduino.h>
#include <ports.h>
#include <base.h>
#include <DirectIO.h>
#include <Adafruit_NeoPixel.h>
#include <TimerOne.h>
#define CLKPIN TIMER1_A_PIN
#define TRGPIN 4
@ohsix
ohsix / 69-my-development-crap.rules
Last active September 12, 2017 20:39
udev rules for dumb stuff
#cp2102
SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="10c4",ENV{ID_MODEL_ID}=="ea60", TAG+="uaccess"
#ch340g
SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1a86",ENV{ID_MODEL_ID}=="7523", TAG+="uaccess"
#ID_SERIAL=Black_Sphere_Technologies_Black_Magic_Probe__STLINK____Firmware_v1.6-rc0-184-g0480578__BED9C80C
SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1d50",ENV{ID_MODEL_ID}=="6018", TAG+="uaccess"
#ID_SERIAL=Prolific_Technology_Inc._USB-Serial_Controller
@ohsix
ohsix / perf.md
Last active December 29, 2023 22:52
stuff I should write down: perf

Intro

perf is very handy, it comes with linux and works without a lot of setup (contrast: oprofile, systemtap)

probes work for kernel and userspace and you can record function arguments and local frame and other variables in the trace

you can use perf script to view the output of such traces, and it will display the variables bundled with the trace, by name, and with the format given when the probe was added

Context

recently someone was asked to record what happened in systemd at source_dispatch, in sd-event; to see what the value of s->description was at the time, they were advised to use gdb