Skip to content

Instantly share code, notes, and snippets.

View raoulduke's full-sized avatar
🐢

Matt raoulduke

🐢
  • Etobicoke
  • 23:08 (UTC -05:00)
View GitHub Profile
@raoulduke
raoulduke / ui.py
Created March 5, 2026 06:52
Raspberry Pi - Read all USB input devices with keyboard capabilities
import sys
import termios
import tty
from evdev import InputDevice, list_devices, categorize, ecodes
from select import select
# Key constants
KEY_UP = "UP"
KEY_DOWN = "DOWN"
KEY_LEFT = "LEFT"
@raoulduke
raoulduke / lcd_wifi_connect.py
Created March 5, 2026 06:51
Raspberry Pi - Wireless network selection with LCD and keyboard
#!/usr/bin/env python3
import subprocess, time, fcntl, sys
from RPLCD.i2c import CharLCD
from ir.ui import read_key, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_ENTER, KEY_BACKSPACE, KEY_QUIT
LCD_I2C_ADDR = 0x27
LOCK_FILE = "/tmp/lcd.lock"
lcd = CharLCD(i2c_expander="PCF8574", address=LCD_I2C_ADDR, cols=16, rows=2, charmap="A00", auto_linebreaks=False)
@raoulduke
raoulduke / lcd_first_boot.py
Created March 5, 2026 06:47
Raspberry Pi - Display IP address on LCD module on boot
import time
import netifaces
from RPLCD.i2c import CharLCD
import fcntl
# --- Configuration ---
WIFI_IFACE = "wlan0"
LCD_I2C_ADDR = 0x27
LOCK_FILE = "/tmp/lcd.lock"
import RPi.GPIO as GPIO
import time
import random
# Setup GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
pwm = GPIO.PWM(17, 1000) # 1kHz PWM frequency
pwm.start(100)
@raoulduke
raoulduke / pull-chain.css
Created February 4, 2021 01:59
HTML/CSS/JS Lamp Pull Chain
#light-switch {
position: fixed;
top: -1.5em;
right: 1em;
text-align: center;
cursor: pointer;
z-index: 1021;
}
#light-switch div.rounded-circle {
@raoulduke
raoulduke / logmond.sh
Last active August 19, 2021 17:32
Log monitor with email
#!/bin/bash
# Monitor file for changes and send email notification
# Usage: ./logmond.sh /path/to/file recipient@domain.com
usage() {
echo "Usage: ./logmond.sh /path/to/file recipient@domain.com"
}
if [ "$#" -ne 2 ]; then
usage
@raoulduke
raoulduke / fitnessdepot_inventory_alert.php
Last active February 3, 2021 22:23
Track FitnessDepot inventory by SKU
<?php
$sku = 'PBSEXP50';
$url = 'https://www.fitnessdepot.ca/WebService/store-inventory.php?store_id=6&price=549.88&sku=' . $sku;
// List of nodes I don't want to check, some store inventory is not up to date
$ignoreNodes = [
'Oakville',
'Call or Email to Order1-877-776-8547ecommerce@fitnessdepot.ca'
];
$foundNodes = [];
@raoulduke
raoulduke / regExMatches.c
Last active June 16, 2025 21:34
C regex get all matches
#include <stdio.h>
#include <string.h>
#include <regex.h>
#define TEST_REGEX "^.*\\/([a-zA-Z_.]*)\\.log : [A-Z]{3} [0-9]{2}\\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{6} .* : (.*)$"
#define MAX_REGEX_MATCHES 5
#define MAX_STRING_SIZE 1000
#define MAX_ERR_LENGTH 50
/**
package main
import (
"fmt"
"os"
"path/filepath"
"regexp"
)
func main() {
@raoulduke
raoulduke / config
Created February 3, 2018 19:30
SSH config for multiple GitHub accounts
# Work
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work
# Personal
Host github.com-personal
HostName github.com
User git