Skip to content

Instantly share code, notes, and snippets.

View liamHowatt's full-sized avatar

Liam Howatt liamHowatt

View GitHub Profile
@liamHowatt
liamHowatt / nuttx_apps_checkout.py
Created May 24, 2026 13:15
git checkout the oldest nuttx-apps commit that is no younger than the checked out nuttx commit
import subprocess
def extract_commit(log):
return log[7:7+40]
def extract_date(log):
return log.splitlines()[4].split("CommitDate:")[1].strip()
outp = subprocess.check_output("git log -1 --pretty=fuller", shell=True).decode()
commit = extract_commit(outp)
@liamHowatt
liamHowatt / cubemx2easyeda.py
Created May 24, 2026 13:12
Convert a pinout exported from STM32CubeMX to an Easy EDA schematic symbol pinout
import csv
import sys
def main():
if len(sys.argv) < 1+1 or len(sys.argv) > 1+2:
print(f"usage: {sys.argv[0]} INPUT_CSV [OUTPUT_FILE]")
return
fi = open(sys.argv[1], newline='')
fo = sys.stdout
@liamHowatt
liamHowatt / pydupes.py
Created May 24, 2026 13:09
A fairly efficient *dupes implementation
import collections
import os
import hashlib
import filecmp
def main():
sizes = collections.defaultdict(list)
for dirent in os.scandir():
if not dirent.is_file(follow_symlinks=False):
@liamHowatt
liamHowatt / errno.py
Created May 24, 2026 13:08
clone of moreutils errno(1)
import errno
import os
import sys
def main():
exitcode = 0
errorcode_inverse = {v: k for k, v in errno.errorcode.items()}
for arg in sys.argv[1:]:
try:
@liamHowatt
liamHowatt / analog_clock.c
Created March 28, 2024 14:12
the new scale example ported to work with the current master from ---- feature(scale): mutiple line needles #5937
static lv_obj_t * scale;
static lv_obj_t * minute_hand;
static lv_obj_t * hour_hand;
static lv_point_precise_t minute_hand_points[2];
static lv_point_precise_t hour_hand_points[2];
static int32_t hour;
static int32_t minute;
static void timer_cb(lv_timer_t * timer)
{