Skip to content

Instantly share code, notes, and snippets.

View classilla's full-sized avatar
🕶️
DEAL WITH IT.

Cameron Kaiser classilla

🕶️
DEAL WITH IT.
View GitHub Profile
@classilla
classilla / ipmifans.sh
Created February 10, 2020 05:02
BitBar and Argos-compatible shell script for getting system fan information over IPMI.
#!/usr/bin/env bash
IPMITOOL=/usr/bin/ipmitool
AWK=/usr/bin/awk
output=`$IPMITOOL sdr type fan | $AWK '{if($5=="ok")print $9}'`
echo -n $output | $AWK 'BEGIN{RS=" ";k=0} {if($1>k)k=$1} END{print k"rpm"}'
echo "---"
echo -n $output | $AWK 'BEGIN{RS=" ";ORS="rpm\n"} {if($1>0)print}'
@classilla
classilla / inetb.c
Created February 15, 2021 05:06
inetb: a single-process multithreaded inetd for pre-BONE BeOS R5
/* inetb: a single-process multithreaded inetd for pre-BONE BeOS R5
** Intel and PowerPC compatible
** MAKE BEBOXES GREAT AGAIN
**
** with Metrowerks:
** cc -O7 -o inetb inetb.c
** (debugging to stderr: cc -DDEBUG -o inetb inetb.c )
** (debugging to socket: cc -DSDEBUG -o inetb inetb.c )
** (you can do -DDEBUG -DSDEBUG together! it's fun!)
**
@classilla
classilla / d3d.s
Created December 13, 2020 23:03
Full anaglyph sprite demo for the C64 (assemble with xa65, LOAD and RUN). https://oldvcr.blogspot.com/2020/12/stereoscopic-computing-anaglyph-sprites.html
; anaglyph sprite demo for the c64
; cameron kaiser 2020
; public domain
SPRITE = $0340
VALUE = $14
HVALUE = $fe
MODE = $15
.word $0801
@classilla
classilla / 3dspr.s
Created December 13, 2020 23:02
6502 assembly to take a value and create an interlaced square sprite of that size (assemble with xa65). https://oldvcr.blogspot.com/2020/12/stereoscopic-computing-anaglyph-sprites.html
; given 0-21, create a sprite sized x by x, skipping every other line
; cameron kaiser 2020
; public domain
SA = $c000
SPRITE = $0340
* = SA
.word SA
@classilla
classilla / pnorex.pl
Created June 22, 2020 05:12
Perl script to extract partitions from OpenPOWER PNOR firmware images.
#!/usr/bin/perl -s
# v1.0 by Cameron Kaiser, talospace@floodgap.com
# Public domain
# By default extract Skiboot and Petitboot.
# Say -parts=DIFFERENT,PARTS to extract, you know, different parts.
# We do not support obtaining the 'part' partition yet (you can just do
# that by truncating the rest of the file anyway).
# Specifying a part multiple times is considered undefined behaviour.
@classilla
classilla / gzdoomdisplay.diff
Created October 5, 2020 04:25
A tweak to always force GZDoom onto a secondary display (useful for 3D monitors). See https://oldvcr.blogspot.com/2020/10/stereoscopic-computing-converting-quake.html
--- sdlglvideo.cpp.OLD 2020-10-04 21:23:32.751041920 -0700
+++ sdlglvideo.cpp 2020-10-04 20:54:21.740470397 -0700
@@ -163,18 +163,19 @@
win_h = bounds.h * 8 / 10;
}
FString caption;
caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
const uint32_t windowFlags = (win_maximized ? SDL_WINDOW_MAXIMIZED : 0) | SDL_WINDOW_RESIZABLE | extraFlags;
@classilla
classilla / quakespasm3d.diff
Created October 5, 2020 04:21
Convert Quakespasm to use interlaced R-L video for passive 3D monitors. See https://oldvcr.blogspot.com/2020/10/stereoscopic-computing-converting-quake.html
--- gl_rmain.c.OLD 2020-08-02 16:35:29.798497930 -0700
+++ gl_rmain.c 2020-10-03 23:32:00.309704966 -0700
@@ -77,16 +77,17 @@
cvar_t gl_affinemodels = {"gl_affinemodels","0",CVAR_NONE};
cvar_t gl_polyblend = {"gl_polyblend","1",CVAR_NONE};
cvar_t gl_flashblend = {"gl_flashblend","0",CVAR_ARCHIVE};
cvar_t gl_playermip = {"gl_playermip","0",CVAR_NONE};
cvar_t gl_nocolors = {"gl_nocolors","0",CVAR_NONE};
//johnfitz -- new cvars
@classilla
classilla / pmu.diff
Last active July 27, 2020 03:05
Hack to enable automatic reboot after a power failure for NetBSD/macppc machines with pmu(4). Based on FreeBSD's. Updated for 9.0.
--- pmu.c.orig 2018-09-03 09:29:25.000000000 -0700
+++ pmu.c 2020-07-26 16:14:05.294338173 -0700
@@ -147,16 +147,17 @@
static int pmu_adb_set_handler(void *, void (*)(void *, int, uint8_t *), void *);
/* i2c stuff */
static int pmu_i2c_acquire_bus(void *, int);
static void pmu_i2c_release_bus(void *, int);
static int pmu_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
void *, size_t, int);
@classilla
classilla / digits_of_pi.dc
Created November 18, 2018 00:11
Compute 50 digits of pi using the venerable old dc utility.
[K 1+k 0 1 1lxlx*+v--lx/sxlf 2*sflx .5<=]s=
[K 1+k 0 1 1lxlx*+v--lx/sxlf 2*sflx 0 .5->>]s>
[ltklxlc*ld/Lxs.Las.Lbs.Lcs.Lds.Les.Lfs.Lgs.Lss.Lts. 3Q]s@
[lbls*sblcla*ldlb*+scldla*sdlcld/sglgle=@ lgsela 2+dsas. 1 1=?]s?
[0St0Ss0Sg0Sf0Se0Sd0Sc0Sb0SaSxlx 0=< Kst 1sflx .5<= lx 0 .5->> 0lx-lx*sslfsblfsc 1sd 1se 3dsas. 1 1=? Lxs.Las.Lbs.Lcs.Lds.Les.Lfs.Lgs.Lss.Lts.0 1Q]sQ
50k
4 1lQx*ps.
@classilla
classilla / lvds.sh
Created June 8, 2019 06:57
Modified /usr/bin/lvds.sh to enable S/PDIF over HDMI on the Raptor Blackbird (with thanks to @madscientist159).
#!/bin/bash
#
# Copyright 2018 - 2019 Raptor Engineering, LLC
# Released under the terms of the GPL v3
# ***** BMC PINMUX *****
# HACK
# Work around pinmux hog failure on cold boot
# Remove this block once the pinmux is fixed in the kernel!