Skip to content

Instantly share code, notes, and snippets.

View WayneKeenan's full-sized avatar

Wayne Keenan WayneKeenan

  • Cambridge, UK
  • 02:26 (UTC +01:00)
View GitHub Profile
@WayneKeenan
WayneKeenan / test_macos_pyobjc_dispatch_observer.py
Last active November 14, 2017 08:04
test_macos_pyobjc_dispatch_observer.py
import threading
from logging import getLogger, basicConfig, DEBUG
from time import sleep
import objc
from Foundation import *
from PyObjCTools import AppHelper
import CoreBluetooth
from ctypes import cdll, Structure, POINTER, pointer, c_int, c_char_p, c_void_p, cast
# http://python.net/crew/theller/ctypes/tutorial.html
# python3 -m venv my-venv
# source my-venv/bin/activate
# pip3 install --upgrade pip setuptools wheel
# python3 dispatch_test.py
# deactivate
import ctypes
import objc
from PyObjCTools import AppHelper
import CoreBluetooth
# python3 -m venv my-venv
# source my-venv/bin/activate
# pip3 install --upgrade pip setuptools wheel
# hg clone https://bitbucket.org/ronaldoussoren/pyobjc pyobjc # e.g. homebrew install mercurial
# cd pyobj
# python3 install.py # You will need XCode installed in order to compile the native extensions.
# python3 ../test_4.1.py
# deactivate
import objc
@WayneKeenan
WayneKeenan / microbit_gpiozero_buttons.py
Created September 19, 2018 11:48
gpiozero buttons on the microbit
from gpiozero import Button
def buttonA_pressed():
print("Button A")
def buttonB_pressed():
print("Button B")
buttonA = Button(13)
buttonA.when_pressed(buttonA_pressed)
from gpiozero import LED
from bubblepy import peripheral, gatt
@gatt.service(0x1234)
class Light:
def __init__(self):
self.led = LED(17)
@gatt.characteristic(0xABCD, ['write'], "Set Light State")
@WayneKeenan
WayneKeenan / build.sh
Last active August 16, 2023 08:24
Build Pico W examples
# You will need: cmake, make and an arm-none-eabi-gcc compiler on your PATH already.
export PROJECT_DIR=$PWD # or anywhere else.
export PICO_SDK_PATH=${PROJECT_DIR}/pico-sdk
export PICO_EXAMPLES_PATH=${PROJECT_DIR}/pico-examples
export PICO_EXTRAS_PATH=${PROJECT_DIR}/pico-extras
git clone https://github.com/raspberrypi/pico-sdk.git
git clone https://github.com/raspberrypi/pico-extras.git
IDENTIFICATION DIVISION.
PROGRAM-ID. TARGET-GUIDANCE.
AUTHOR. YOUR NAME.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
@WayneKeenan
WayneKeenan / summaries_db.json
Created February 21, 2025 06:52
CAT page AI summaries
[
{
"pageId": 1786,
"pageUrl": "https://wiki.rossmanngroup.com/wiki/index.php?curid=1786",
"summaryDetails": {
"originalSummary": "Below is a list of companies that have dedicated articles in the CAT wiki.",
"originalSummaryLength": 74,
"aiSummary": "List of companies with dedicated articles in the CAT wiki.",
"aiSummaryLength": 58,
"error": ""