Skip to content

Instantly share code, notes, and snippets.

View tuna-f1sh's full-sized avatar

John Whittington tuna-f1sh

View GitHub Profile
@tuna-f1sh
tuna-f1sh / binary.v
Last active February 25, 2023 16:06
reg [3:0] d0;
reg [3:0] d1;
always @(posedge clk)
begin
d0 <= ((d0 & 9) == 9) ? 4'b0 : d0 + 1;
if ((d0 & 9) == 9) d1 <= d1 + 1;
end
@tuna-f1sh
tuna-f1sh / Makefile
Last active October 25, 2023 14:49
arduino-cli Makefile
USER_LIB_PATH = lib
OBJDIR = bin
TARGET = $(firstword $(wildcard *.ino))
BOARD_TAG ?= arduino_zero_native
FQBN ?= adafruit:samd:adafruit_feather_m0
UPLOAD_PORT ?= $(wildcard /dev/tty.usbmodem*)
# just to trigger changes to target bin
CSRC := $(shell find . -type f -name '*.c')
@tuna-f1sh
tuna-f1sh / async_game_of_life_pil.py
Last active January 23, 2024 06:11
Async task that updates PIL Image with Game of Life
"""
Game of Life async task that updates passed PIL Image with generations
loosely based on https://codereview.stackexchange.com/questions/125292/conways-game-of-life-in-python-saving-to-an-image
but fixes the critical bug which runs the frame update loop on a transient grid resulting in wrong behaviour - I don't have enough points to post fix!
Copied from part of a bigger project I'm working on, this can still be run with the python flipdot module imported using a script.
"""
import random, asyncio
from PIL import Image