Skip to content

Instantly share code, notes, and snippets.

View stpettersens's full-sized avatar

Sam Saint-Pettersen stpettersens

View GitHub Profile
@stpettersens
stpettersens / rpla.py
Last active February 7, 2026 21:49
Simple program to find resistance for a given resistivity in ohm metre on copper or aluminium wires given length and c.s.a.
#!/usr/bin/env python3
# Simple program to find resistance
# Author: Sam Saint-Pettersen, Feb 2026
# R = pL/A for a given resistivity in ohm metre (i.e. pCu or pAl).
import os
import sys
# Resistivities
resists: dict[str,float] = {
@stpettersens
stpettersens / onefetch_c3.diff
Created February 5, 2026 19:28
Patch onefetch's c3 logo to use my version of the logo.
--- languages.yaml 2026-02-01 16:31:21.483241400 +0000
+++ ../onefetch_c3/languages.yaml 2026-01-26 17:25:19.510650800 +0000
@@ -263,30 +263,32 @@
C3:
type: programming
ascii: |
- {0} .d8{1}888{2}b. {3} .d8{4}888{5}b.
- {0}d88P{1} Y{2}88b {3}d88P{4} Y{5}88b
- {0}888 {1} {2}888 {3} {4} .d{5}88P
- {0}888 {1} {2} {3} {4}888{5}8"
@stpettersens
stpettersens / onefetch_c3_cargo.toml
Created January 26, 2026 17:09
This is the interim Cargo.toml for my fork of onefetch that adds C3 language support.
[workspace.package]
authors = ["o2sh <ossama-hjaji@live.fr>"]
edition = "2024"
license = "MIT"
version = "2.26.1"
repository = "https://github.com/o2sh/onefetch"
[workspace]
members = ["ascii", "image", "manifest"]
@stpettersens
stpettersens / Dockerfile.python
Last active December 4, 2025 00:31
Dockerfile to build Python 3.13.9 from source with an Alpine image.
# Dockerfile to build Python 3.13.9 from source with an Alpine image.
FROM alpine:latest
# Install build dependencies for python and git
RUN sed -i '2s/^# *//' /etc/apk/repositories
RUN apk update && apk add --no-cache build-base zlib-dev openssl-dev git
# Create python directory.
RUN mkdir -p /usr/build/python
WORKDIR /usr/build/python
@stpettersens
stpettersens / rc.xml
Last active November 4, 2025 16:15 — forked from downthecrop/rc.xml
A Better Aero Snap with Openbox
<!-- Window Tiling: Emulates Windows 7 Snap feature JASON CAVETT -->
<keybind key="W-J">
<action name="UnmaximizeFull"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MoveToEdgeWest"/>
</keybind>
<keybind key="W-L">
@stpettersens
stpettersens / dtc.openbox.conf
Created November 3, 2025 16:04 — forked from downthecrop/dtc.openbox.conf
Useful links for openbox/tint2/urxvt
Openbox
Tint2
Urxvt
lxappearance
breeze dark
for system-wide mouse configuration, one can edit /usr/share/icons/default/index.theme
tint2conf is the customizer
sudo xbps-query -Rs rxvt
@stpettersens
stpettersens / update-brave-void.sh
Last active February 5, 2026 19:03
Update Brave browser on a Void Linux system (makes use of xdeb tool and Brave Debian package releases).
#!/usr/bin/env bash
# Update Brave browser on a Void system.
install_latest_brave_deb() {
# Get machine architecture.
local arch
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
arch="amd64"
elif [ "$arch" == "aarch64" ]; then
@stpettersens
stpettersens / fix-hang-rescuezilla.sh
Created September 17, 2025 17:17
Fix hanging on 'os-prober' for Rescuezilla
#!/bin/sh
killall -9 grub-mount
@stpettersens
stpettersens / rotten_tomatoes_links_for_jellyfin-2025-09-07.user.js
Last active November 12, 2025 17:46
Rotten Tomatoes Links for Jellyfin user script (my instance).
@stpettersens
stpettersens / Rotten Tomatoes Links-2025-09-07.user.js
Last active September 15, 2025 15:55
Rotten Tomatoes Links for Jellyfin user script.