Skip to content

Instantly share code, notes, and snippets.

View twisted-nematic57's full-sized avatar
🫥

twisted-nematic57

🫥
View GitHub Profile
@twisted-nematic57
twisted-nematic57 / reset-hardware.sh
Created September 4, 2026 02:39
Software duct tape over my Framework Laptop 12's hardware issues
#!/bin/bash
# FW12 KDE on-the-fly touchpad & display fixer script by Akshaya Singh (twisted_nematic57)
# Effects:
# 1. Gently turns on and off all connected displays. (Can temporarily fix eDP loose connection issues)
# 2. Effectively "reboots" the trackpad firmware by removing it from the PCI bus and then re-adding it. (Can temporarily fix severe discalibration issues caused by sweaty hands)
# [Note on "temporary": just run the script again if these problems begin again.]
# To use:
# 0. Run `cat /proc/bus/input/devices` and look for "PIXA3854:00 093A:0239 Touchpad". Note down the start of its Sysfs address, e.g. mine is `/devices/pci0000:00/0000:00:19.0`
# 1. Place this script in ~/.local/bin/reset-hardware.sh
# 2. Add `{yourusername} ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/bus/pci/devices/0000\:00\:19.0/remove, /usr/bin/tee /sys/bus/pci/rescan`; change the 19 to whatever you got in step 0
# --- MLStringHelper Test Suite ---
print("Starting MLStringHelper tests...")
# 1. Test Initialization and Basic Line Counting
helper = MLStringHelper("Line 0\nLine 1\nLine 2")
assert helper.num_lines() == 3, "Fail: Initial line count should be 3"
assert helper.get_line(0) == "Line 0", "Fail: get_line(0) failed"
assert helper.get_line(1) == "Line 1", "Fail: get_line(1) failed"
assert helper.get_line(2) == "Line 2", "Fail: get_line(2) failed"
@twisted-nematic57
twisted-nematic57 / llama-limit.bat
Created February 14, 2026 03:14
llama-server CPU usage limiter
@echo off
REM Restricts llama-server to a certain set of CPU cores.
REM Argument: integer representing the # of cores to limit to
echo Setting llama-server affinity to last %1 cores...
REM Hardcoded CPU affinity masks for my 12-core system because I'm too lazy to do this elegantly.
REM The "first" cores are P-cores and the "last" ones are E-cores; I want to keep P-cores free for
@twisted-nematic57
twisted-nematic57 / candle.py
Created October 31, 2025 19:02
hallowen candle made in 1hr
# CANDLE v0.1.0
# Contributors to this file:
# - twisted_nematic57
# This file is Public Domain
import machine
import rp2
import sys # I don't know why this is needed
import _thread
from time import * # why not `import time`? we'll never know
@twisted-nematic57
twisted-nematic57 / darkpdf.css
Created February 19, 2023 01:44
Paste this into your console to make PDFs dark mode! (this also inverts the color of images) Works best on Firefox
viewer.style = 'filter: grayscale(100%) invert(84%) contrast(178%) brightness(82%)'
@twisted-nematic57
twisted-nematic57 / git_create_orphan.sh
Created October 9, 2022 03:33 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name