Skip to content

Instantly share code, notes, and snippets.

View kevinmcaleer's full-sized avatar

Kevin McAleer kevinmcaleer

View GitHub Profile
@kevinmcaleer
kevinmcaleer / syncthing.service
Last active April 19, 2024 09:01
syncthing_installer.sh
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=network.target
[Service]
User=pi
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
RestartSec=5
@kevinmcaleer
kevinmcaleer / portainer-ce.sh
Created December 11, 2023 11:08
Portainer install
#!/bin/bash
docker run -itd --name Portainer -p 8000:8000 -p 9443:9443 -v /var/run/docker.sock:/var/run/docker.sock cr.portainer.io/portainer/portainer-ce:latest
@kevinmcaleer
kevinmcaleer / gpiozero_benchmark.py
Created September 17, 2023 11:47
GPIO Benchmarking tool
import time
from gpiozero import LED
# Setup
led = LED(17)
iterations = 100000 # Number of times the LED will be toggled on and off
# Benchmark
start_time = time.time()
@kevinmcaleer
kevinmcaleer / lesson_01_movement.ino
Last active September 10, 2023 14:02
SMARS Demo program
// Lesson 01 Movement
// www.smarsfan.com/play/lessons/lesson_01_movement
// set Motor A to Arduino Pins
int motor_A = 12;
int motor_B = 13;
// set the Motor Speed using the Arduino Pins
int motor_A_speed = 10;
int motor_B_speed = 11;
@kevinmcaleer
kevinmcaleer / tiny_code_reader.py
Created September 8, 2023 13:24
Tiny Code Reader
# SPDX-FileCopyrightText: 2023 Pete Warden
# SPDX-License-Identifier: Apache-2.0
#
# Example of accessing the Tiny Code Reader from Useful Sensors on a Trinkey
# using CircuitPython. See https://usfl.ink/tcr_dev for the full developer guide.
# Modified by Kevin McAleer to run on standard MicroPython (original code was CircuitPython)
from machine import I2C, Pin
import struct
@kevinmcaleer
kevinmcaleer / README.md
Last active July 26, 2023 22:03
Image Recognition for Googley Eyes

Setting up the image recogition

OpenAI has a nice automatic image captioning service, you can get this up and running by

  1. Create a virtual environment:

    python3 -m venv venv
@kevinmcaleer
kevinmcaleer / emoji.py
Last active July 17, 2023 14:09
Happy Emoji Day!
# Did you know you can print Emojis in Python?
print("🥰 Happy 🌎 Emoji day! ❤️ 🐍🐍🐍")
@kevinmcaleer
kevinmcaleer / remote.py
Last active February 12, 2024 21:17
Bluetooth Remote Control for Raspberry Pi Pico W
# Kevin McAleer
# 2023-06-28
# Bluetooth cores specification versio 5.4 (0x0D)
import sys
import aioble
import bluetooth
import machine
import uasyncio as asyncio
@kevinmcaleer
kevinmcaleer / picotamachibi.py
Created June 12, 2023 20:13
Picotamachibi version 1.0
# from icons import food_icon
from machine import I2C, Pin
from ssd1306 import SSD1306_I2C
from icon import Animate, Icon, Toolbar, Button, Event
from time import sleep
import framebuf
import gc
sda = Pin(0)
scl = Pin(1)
@kevinmcaleer
kevinmcaleer / Lego_self_balancing_robot.py
Created April 2, 2023 16:51
A Lego Self Balancing Robot
from pybricks.geometry import Axis
from pybricks.hubs import InventorHub
from pybricks.parameters import Direction, Port
from pybricks.pupdevices import ColorSensor, Motor
from pybricks.tools import StopWatch, wait
# Initialize motors.
left = Motor(Port.C, Direction.COUNTERCLOCKWISE)
right = Motor(Port.D)
left.reset_angle(0)