Skip to content

Instantly share code, notes, and snippets.

View konsumer's full-sized avatar

David Konsumer konsumer

View GitHub Profile

To publish for M5 Loader/Burner, you need to merge your firmware:

esptool.py --chip esp32 merge_bin -o merged_firmware.bin --flash_mode dio --flash_size 4MB 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.bin

you will see the log of the filenames and offsets when you run pio run -t upload

@konsumer
konsumer / github_verified.md
Created April 8, 2026 00:50
I want to just use my SSH key to have "Verified" commits on Github. This is a quick setup, on Mac.
ssh-keygen

git config --global gpg.format ssh
git config --global user.signingKey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
git config --global gpg.ssh.program /usr/bin/ssh-keygen

cat ~/.ssh/id_ed25519.pub
@konsumer
konsumer / add_duckdb_extension_footer.py
Created March 17, 2026 17:57
DuckDb native extensions require some footer-data. THis adds it to the the dynamic-lib.
@konsumer
konsumer / ThemeSelect.jsx
Last active December 12, 2025 10:18
Switches daisyui theme (body:data-theme). Optionally, it will follow user's media-preference, and persists their choice.
import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik'
// switches daisyui theme (body:data-theme)
// optionally, it will follow user's media-preference, and persists their choice
export default component$(({ themeDark = 'dark', themeLight = 'light', useDarkPref }) => {
const theme = useSignal(true)
useVisibleTask$(() => {
if (localStorage.theme) {
document.body.dataset.theme = localStorage.theme
@konsumer
konsumer / d1_diff_migrate.sh
Last active November 7, 2025 00:47
Say you have a remote D1 database called "DB". You can run this to produce a diff-migration for structure.sql: `./d1_diff_migrate.sh feature1 DB structure.sql`, then run `npx -y wrangler d1 migrations apply DB`
#!/bin/bash
# this will create a D1 migration that diffs the current remote database
set -eo pipefail
if ! command -v npx &> /dev/null; then
echo "npx needs to be in your path." >&2
exit 1
fi
// for https://www.tztstore.com/goods/show-7983.html
// put this in Arduino/libraries/TFT_eSPI/
#define USER_SETUP_INFO "CYD"
#define ILI9341_2_DRIVER
#define TFT_INVERSION_ON
#define TFT_WIDTH 240
#define TFT_HEIGHT 320
@konsumer
konsumer / pi-gen.sh
Created July 8, 2025 21:43
Basic pi-gen config for arm64 pi image (lite)
git clone https://github.com/RPi-Distro/pi-gen.git
cd pi-gen
git checkout arm64
cat << EOF > config
IMG_NAME=nullos-pi-lite-bookworm-aarch64
PI_GEN_RELEASE="NullOS Pi"
RELEASE=bookworm
TARGET_HOSTNAME=nullos
KEYBOARD_KEYMAP=us
@konsumer
konsumer / fflatefs.js
Last active June 21, 2025 09:17
Stupidly-minimal fs that uses fflate on the zip. It's just enough to load js carts, and read files, but not much else.
// stupidly-minimal fs that uses fflate on the zip
// it's just enough to load js carts, and read files, but not much else
import * as fflate from 'fflate' // https://esm.sh/fflate/esm/browser.js
const FILETYPE_REGULAR_FILE = 4
const FILETYPE_DIRECTORY = 3
export default async function fflatefs(cartUrl) {
const info = {}
@konsumer
konsumer / fflate.js
Created June 21, 2025 09:14
stupidly-minimal fs that uses fflate on the zip
// stupidly-minimal fs that uses fflate on the zip
// it's just enough to load js carts, and read files, but not much else
import * as fflate from 'fflate' // https://esm.sh/fflate/esm/browser.js
const FILETYPE_REGULAR_FILE = 4
const FILETYPE_DIRECTORY = 3
export default async function fflatefs(cartUrl) {
const info = {}
@konsumer
konsumer / 0_toolgen.py
Last active October 20, 2024 00:16
Generate AI tool description from a python file
from docstring_parser import parse
import tools
def tool_parse(tools):
"""
build AI tools-definition from python functions & docs
"""
toolsOut = []
for fname in dir(tools):
if not fname.startswith('__'):