Skip to content

Instantly share code, notes, and snippets.

View bradmartin333's full-sized avatar

Brad Martin bradmartin333

View GitHub Profile
@bradmartin333
bradmartin333 / code.py
Created May 14, 2026 16:04
RP2040 TM1637 60FPS timecode
import board
import digitalio
import time
import touchio
from adafruit_debouncer import Button
# Update these pins to match your wiring.
TM1637_CLK_PIN = board.GP3
@bradmartin333
bradmartin333 / vikunja_check_users.sh
Created May 12, 2026 16:48
script for snooping on vikunja users to see who has updated their profiles
#!/bin/bash
# Define the state file to store previous runs
STATE_FILE=".vikunja_user_deltas.state"
TMP_STATE="${STATE_FILE}.tmp"
# Initialize an associative array to hold the previous state
declare -A prev_deltas
# Load the previous state if the file exists
@bradmartin333
bradmartin333 / vikunja_add_users.sh
Created May 12, 2026 16:47
simple TUI for adding users to a vikunja server
#!/bin/bash
# --- Configuration ---
VIKUNJA_CONTAINER="vikunja-vikunja-1"
VIKUNJA_BINARY="/app/vikunja/vikunja"
DEFAULT_PASSWORD="changeme"
# UI Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
@bradmartin333
bradmartin333 / write_from_json.py
Last active March 19, 2026 11:48
write json to Postgres db
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "psycopg2-binary",
# ]
# ///
import json
import sys
from pathlib import Path
@bradmartin333
bradmartin333 / explore.py
Created March 19, 2026 11:32
explore Postgres db via CLI
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "psycopg2-binary",
# "tabulate",
# ]
# ///
import os
import psycopg2
@bradmartin333
bradmartin333 / thermal_print_png.py
Created November 14, 2025 15:58
downscale PNG and print on bluetooth printer from Windows
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "pillow>=11.2.1",
# ]
# ///
# usage: uv run this_script.py <path_to_png>
import sys
@bradmartin333
bradmartin333 / fps_tester.ino
Last active October 30, 2025 11:51
use a 4 digit 7 segment display for FPS testing
#include <TM1637Display.h>
#define CLK_PIN 2
#define DIO_PIN 3
const int SPEED_PINS[] = { 4, 5, 6, 7 };
const int NUM_SPEED_PINS = sizeof(SPEED_PINS) / sizeof(SPEED_PINS[0]);
const int REFRESH_RATES_HZ[] = { 30, 60, 90, 120 };
const int RATE_DEFAULT_HZ = 1;
@bradmartin333
bradmartin333 / make_timecode_clip.ps1
Last active October 29, 2025 22:11
powershell script for generating test clips
<#
.SYNOPSIS
Generates a high frame rate video with SMPTE timecode overlay.
.DESCRIPTION
This script creates a video file with a timecode burned in using FFmpeg.
The video frame rate is configurable and can be set to any desired duration.
.PARAMETER Duration
Duration of the video in seconds (default: 10)
@bradmartin333
bradmartin333 / greyscale_heatmap.dart
Created July 24, 2025 15:01
turn greyscale Int16 data into a red-green heatmap
import 'dart:typed_data';
import 'package:image/image.dart' as img;
const dim = 512;
const maxInt16Value = 32767;
const maxInt8Value = 255;
final Int16List testData = () {
final buffer = Int16List(dim * dim);
@bradmartin333
bradmartin333 / main.dart
Last active July 11, 2025 20:53
button row
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
}