Skip to content

Instantly share code, notes, and snippets.

View recantha's full-sized avatar

Michael Horne recantha

View GitHub Profile
@recantha
recantha / gist:01723d8ad894b54a8b17edd7ce90f8b1
Last active May 25, 2021 11:09
Conway's Game of Life for the Raspberry Pi Pico with Pimoroni Pico Scroll pack
# Conway's Game of Life
# Converted by Michael Horne from Steve Baines' Pico Unicorn pack example (Thanks to Tony Goodhew for spotting!)
# https://forums.pimoroni.com/t/pico-unicorn-pack-not-working-in-micropython/15997/5
# 14 Feb 2021 - Pimoroni UF2 0.0.7
import picoscroll as pico_addon
import random
import time
pico_addon.init()
# This is the code from: https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/circuitpython-wiring-test
# On a Raspberry Pi Pico, WHICH DOES NOT HAVE I2S... Distortion aside, this sounds correct.
# How is that possible?
import time
import array
import math
import audiocore
import board
import audiobusio
# AMG8833 thermal camera on an ILI9341 320x240 screen
# Michael Horne, based on Jan Goolsbey's code for Adafruit
# https://learn.adafruit.com/pygamer-thermal-camera-amg8833?view=all
import time
import board
import displayio
import busio
from simpleio import map_range
from adafruit_display_text.label import Label
import time
import board
from digitalio import DigitalInOut, Direction, Pull
import pwmio
from analogio import AnalogIn
led1 = pwmio.PWMOut(board.GP7, frequency=5000, duty_cycle=0)
led2 = DigitalInOut(board.GP8)
led2.direction = Direction.OUTPUT
@recantha
recantha / getDateTimeZone.cfm
Created July 12, 2024 09:00
A CFML function to determine whether a date is in GMT or BST for the Europe/London region
<cffunction name="getDateTimeZone" returntype="string" access="public">
<cfargument name="the_date" type="date" required="true">
<cfset var local = {}>
<cftry>
<cfset local.timezone = "">
<cfset local.obj_timezone = createObject("java", "java.util.TimeZone").getTimeZone("Europe/London")>
<cfset local.is_daylight_time = local.obj_timezone.inDaylightTime(arguments.the_date)>