Skip to content

Instantly share code, notes, and snippets.

View Steve-Tech's full-sized avatar
📚
Studying

Stephen Horvath Steve-Tech

📚
Studying
  • Queensland University of Technology
  • Brisbane, Australia
View GitHub Profile
@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 November 12, 2024 21:32
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:
@Steve-Tech
Steve-Tech / JGINYUE X99-D8.conf
Created July 4, 2022 05:16
JGINYUE X99-D8 lm-sensors config
chip "nct6779-isa-0a20"
label fan2 "CPU0_FAN"
label fan1 "CPU1_FAN"
label in0 "+12V"
label in3 "+3.3V"
label in7 "3VSB"
label in8 "VBAT"
label in9 "VTT"
label in2 "AVCC"
label temp7 "CPU_PECI"
@Steve-Tech
Steve-Tech / ESP32-MCPWM.ino
Created June 22, 2022 01:23
ESP32 MCPWM Timer Sync Offset
/*
* ESP32 MCPWM Timer Sync Offset
* by Steve-Tech
* Creates an output like
* _ _
* TIMER0: | |___| |___|; or 10001000
* _ _ | | | |
* TIMER1: ___| |___| |_; or 00100010
*
* Sources:
@Steve-Tech
Steve-Tech / README.md
Last active March 4, 2022 10:42
Python Gaugan Web API

Interact with the GauGAN2 web demo using python

Inspired by DoodleChaos who would've made something similar for this video.

Usage

Import with from gaugan import gaugan

<> = optional argument

gaugan(input png name, <output jpg name>, <caption>)

@Steve-Tech
Steve-Tech / cloudflare-ddns-upnp.py
Created July 1, 2021 13:25
Cloudflare DDNS with UPnP support
#!/usr/bin/python3
#
# Original Code: https://github.com/timothymiller/cloudflare-ddns
# Cloudflare DDNS with UPnP Support
# Tested on a Telstra Smart Modem, will most likely need configuration on other modems.
# upnpclient could possibly be used to find the location/url and things
#
import requests, json, sys, signal, os, time, threading
from xml.etree import ElementTree