Skip to content

Instantly share code, notes, and snippets.

@quark-zju
quark-zju / epd-dither-resize-spectra6.py
Last active February 11, 2026 23:41
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 February 6, 2026 07:17
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;

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
@trvswgnr
trvswgnr / .bash_profile
Last active September 10, 2024 01:11
My Bash Profile
# TAW Bash Profile
# @author: Travis A. Wagner
# @website: http://travisawagner.com
# -- BASE --#
# Set default blocksize for ls, df, du
# http://hints.macworld.com/comment.php?mode=view&cid=24491
export BLOCKSIZE=1k