Skip to content

Instantly share code, notes, and snippets.

@quark-zju
quark-zju / epd-dither-resize-spectra6.py
Last active April 16, 2026 13:06
Process image for spectra 6 color e-ink display (Waveshare ESP32-S3 PhotoPainter) use-cases
#!/usr/bin/env python3
"""
Script to generate BMP images used by waveshare's ESP32-S3-PhotoPainter
ESP32-S3-PhotoPainter: https://www.waveshare.com/wiki/ESP32-S3-PhotoPainter
Forked from waveshare's color tool: https://files.waveshare.com/wiki/common/ConverTo6c_bmp-7.3.zip
with changes:
- Rotate automatically.
- Adopted epdoptimize's real-world colors: https://github.com/Utzel-Butzel/epdoptimize
@trvswgnr
trvswgnr / compress_video
Last active April 23, 2026 21:29
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@todbot
todbot / mp3-cycler.py
Last active February 9, 2025 22:06
Play high-quality MP3s on RP2350 Tiny 2350 using the MacroPadSynthPlug as audio interface
# mp3-cycler.py -- Play high-quality MP3s on RP2350 Tiny 2350
# using the MacroPadSynthPlug as audio interface
# 15 Aug 2024 - @todbot / Tod Kurt
import time, os, random
import board
import audiocore, audiopwmio, audiomixer, audiomp3
import busio
import keypad
import rainbowio
@todbot
todbot / derpnote2-rp2350.py
Created August 15, 2024 00:20
My sound piece attempting to recreate the THX "Deep Note" sound, with display
# derpnote2-rp2350.py - My sound piece attempting to recreate the THX "Deep Note" sound, with display
# 14 Aug 2024 - @todbot / Tod Kurt
#
import asyncio
import board, audiopwmio, audiomixer, audiocore, synthio, random, time
import busio, displayio, terminalio, vectorio
import keypad
import neopixel
import adafruit_displayio_ssd1306
from adafruit_display_text import bitmap_label as label
@todbot
todbot / EZ_USB_MIDI_HOST_PIO_example_midisend.ino
Last active November 15, 2024 04:01
USB MIDI Host using PIO on RP2040 USB Type A Host Feather
/**
* Modified 12 Jun 2024 - @todbot -- added USB MIDI forwarding
* originally from: https://github.com/rppicomidi/EZ_USB_MIDI_HOST/blob/main/examples/arduino/EZ_USB_MIDI_HOST_PIO_example/EZ_USB_MIDI_HOST_PIO_example.ino
* Be sure to set "Tools / CPU Speed" to 120 MHz or 240 MHz and
* be sure to set "Tools / USB Stack" to "Adafruit TinyUSB"
*/
/*
* The MIT License (MIT)
*
@amb
amb / parallel_pio.c
Last active July 14, 2024 14:32
Simple parallel out with RP2040 PIO
#include <stdio.h>
#include "hardware/clocks.h"
#include "hardware/pio.h"
#include "hardware/timer.h"
#include "main.pio.h"
#include "pico/stdlib.h"
#define START_PIN 10
#define ROW_PINS 4
@hollyhockberry
hollyhockberry / main.cpp
Last active May 2, 2025 19:44
M5Paper: LVGL Sample (with LGFX)
#define LGFX_AUTODETECT
#define LGFX_USE_V1
#include <lvgl.h>
#include <M5EPD.h>
#include <LovyanGFX.hpp>
static const uint16_t screenWidth = 960;
static const uint16_t screenHeight = 540;
lv_disp_draw_buf_t draw_buf;
@dudmuck
dudmuck / chirpstack.md
Last active April 10, 2026 09:13
chirpstack setup instructions

welcome to the ghetto of network servers

(aka chirpstack installation steps)

platforms

The typical installation likely is into a virtual machine or into remote instance on the cloud. However when installing directly onto local machine, ansible probably doesnt do much for you.

Chirpstack installs on debian based platforms, eg Ubuntu or raspberry pi. Other distributions with different packaging management would require downloading chirpstack binaries.

If you're a windows 10 user, you may chose to practice installation on WSL2. Although WSL would never be used for actual server (by any sane person), its useful to run virtual machine to familiarize yourself with install / setup procedure of chirpstack. Watch this video if you havent already got WSL2 on windows 10. Be sure to set default to WSL2

Aside from estimating it, you can also ask the eMMC itself to tell you how far it has degraded so far (assuming it supports EMMC 5.1 or above).

The JEDEC standard (JESD84-B51) specifies that in the ext_csd field (offset 268-269) bytes indicate the level of type A/B wear. (value 0x1-0xA reflects 10%-100%, 0x0B means lifetime exceeded)

For example, on a typical linux distro, you could run the following script in bash to tell you:

@jschoch
jschoch / haptic_lever.ino
Created December 4, 2020 22:12
haptic detent with simpleFOC
// Open loop motor control example for L298N board
#include <SimpleFOC.h>
#include <neotimer.h>
#define IN1 14
#define IN2 12
#define IN3 13
//#define IN4 8
// BLDC motor & driver instance