Skip to content

Instantly share code, notes, and snippets.

View Steve-Tech's full-sized avatar

Stephen Horvath Steve-Tech

View GitHub Profile
@Steve-Tech
Steve-Tech / Casablanca.yaml
Created June 7, 2025 08:36
ESPHome Casablanca IR (SM5021BL) Light & Fan Remote Config
# ESPHome Casablanca IR Light & Fan Remote Config
# These remotes use the SM5021BL IC, the values are calculated as per the datasheet.
# Add this to an existing config and change GPIO0 to whatever pin you have chosen to use.
remote_transmitter:
pin: GPIO0
carrier_duty_percent: 50%
output:
- platform: template
@Steve-Tech
Steve-Tech / Casablanca.ino
Created June 7, 2025 08:35
Casablanca IR (SM5021BL) Light & Fan Remote + DHT & LDR Arduino Program
// Casablanca IR Light & Fan Remote Arduino Program
// These remotes use the SM5021BL IC, the values are calculated as per the datasheet.
// This program also incorporates a DHT11 temp sensor and an LDR and prints the values over serial every 2 seconds.
// This program was also written years ago so it might be broken now.
#include <DHT.h>
#define SEND_PWM_BY_TIMER
#define DISABLE_CODE_FOR_RECEIVER
#define EXCLUDE_EXOTIC_PROTOCOLS
#define EXCLUDE_UNIVERSAL_PROTOCOLS
@Steve-Tech
Steve-Tech / AMDResetStatus.cpp
Last active May 13, 2025 08:13
Gets the reset reason on AMD systems
// AMDResetStatus.cpp : Gets the reset reason on AMD systems
//
// Parts copied from https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=b343579de7b250101e4ed6c354b4c1fa986973a7
#include <iostream>
#include <filesystem>
#include <fstream>
#include "Windows.h"
#include "PawnIOLib.h"
@Steve-Tech
Steve-Tech / i915_mem_usage.c
Created December 11, 2024 00:58
Get memory usage from i915 drivers
#include <assert.h>
#include <drm/drm.h>
#include <drm/i915_drm.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
@Steve-Tech
Steve-Tech / ec-lpc-memmap.py
Created April 26, 2024 00:41
Read a CrOS fan speed using the memmap, for Framework Laptops (AMD, but could be adjusted for other laptops)
# Requires portio and usually root access
# If you're using a venv, run it something like `sudo .venv/bin/python ec-lpc-memmap.py`
import portio
EC_LPC_ADDR_MEMMAP = 0xE00 # will be 0x900 on most other models
EC_MEMMAP_SIZE = 255
EC_MEMMAP_FAN = 0x10
if portio.ioperm(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, True):
@Steve-Tech
Steve-Tech / codec-reader.py
Last active April 8, 2025 02:04
Codec Reader for HTML Video Tags, gets the correct codecs parameter for AV1 and H.264 videos.
import json
import mimetypes
import subprocess
import sys
# Codec Reader for HTML Video Tags by Steve-Tech
# Usage: python3 codec-reader.py [-d] file_name
# Requires ffmpeg and ffprobe to be installed.
#
# Supported Codecs:
@Steve-Tech
Steve-Tech / QUT Canvas++.js
Last active August 15, 2024 02:00
Enhancements to the QUT Canvas, may work on other instances of Canvas by Instructure. Re-sorts the 'Courses' menu by semester & changes the course link to the modules page.
// ==UserScript==
// @name QUT Canvas++
// @namespace https://stevetech.me/
// @version 0.4.2
// @description Enhancements to the QUT Canvas, may work on other instances of Canvas by Instructure.
// @author Steve-Tech
// @match https://canvas.qut.edu.au/*
// @icon https://instructure-uploads-apse2.s3.ap-southeast-2.amazonaws.com/account_218620000000000001/attachments/792/favicon.ico
// @grant none
// @run-at document-idle
@Steve-Tech
Steve-Tech / recorder.py
Created July 1, 2023 13:52
Flight Recorder for BoardConnect
# Flight Recorder for BoardConnect (Lufthansa Systems GmbH & Co. KG)
# Records flight data in a csv format, see the headers variable for the headers.
import requests
import csv
from time import sleep
header = ('utc', 'flightNumber', 'aircraftRegistration', 'aircraftType', 'callSign', 'altitude', 'groundSpeed', 'heading', 'lon', 'lat', 'distDest', 'temperature')
first = True
@Steve-Tech
Steve-Tech / fastchat-t5.py
Created June 22, 2023 13:02
Intel Extension for PyTorch LLM Example
# Code modified from https://huggingface.co/CarperAI/stable-vicuna-13b-delta
# in order to use Intel Extension for PyTorch (IPEX) to run on Intel Arc GPUs
# and for fastchat-t5-3b-v1.0, since it can fit in 8GB of VRAM using BF16
# or 16GB of VRAM using FP32. IPEX/Arc does not seem to support bare FP16.
# Follow the instructions here to install IPEX:
# https://intel.github.io/intel-extension-for-pytorch/xpu/1.13.120+xpu/tutorials/installation.html
# And remember to source setvars.sh before running this script:
# `source {ONEAPI_ROOT}/setvars.sh` e.g. `source /opt/intel/oneapi/setvars.sh`
@Steve-Tech
Steve-Tech / README.md
Last active December 14, 2023 09:30
ARC Reactor, CLI Monitoring for Intel Arc (requires xpu-smi)

ARC Reactor

ARC Reactor is a simple monitoring script with an epic name for Intel ARC GPUs, it provides an interface similar to xpu-smi stats but with the blank values removed for easier viewing and will refresh every second. However, ARC Reactor still requires xpu-smi to be installed, as it uses xpu-smi dump to collect the information.

Usage

usage: arc-reactor.py [-h] [-d DEVICE] [-m METRICS] [-i I] [-n N] [-c]

options: