Skip to content

Instantly share code, notes, and snippets.

View scolton99's full-sized avatar
🐢

Spencer Colton scolton99

🐢
  • Northwestern University
  • Chicago, IL
View GitHub Profile
@scolton99
scolton99 / Makefile
Created February 23, 2026 16:11
Updated Makefile for the "errorcodes" prc-tools sample project to avoid relying on nondeterministic output order from find.
# Makefile: Convert Palm OS error codes into symbolic error names.
#
# Copyright (c) 2001 John Marshall.
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
#!/usr/bin/env fish
set DEPS 'autogen' 'base-devel'
set YAYDEPS 'palm-os-sdk-git'
set REPONAMEORDER 'pilrc-sc' 'prc-tools-sc' 'pilot-link-sc' 'jpilot-sc'
sudo pacman -S --needed --noconfirm $DEPS
@scolton99
scolton99 / testTCPPort.sh
Created December 17, 2025 13:20
Test TCP port (headless)
#!/bin/bash
HOST=fqdn.example.com
PORT=8000
nc -z -w 5 "$HOST" "$PORT" && echo "Do this if the port is OPEN" || echo "Do this if the port is CLOSED"
@scolton99
scolton99 / wait-for-port.sh
Last active July 7, 2025 14:02
Script for DAPS to wait for a service to come available on a certain port before returning
#!/bin/bash
MAX_ATTEMPTS=120
if [[ -z "$1" ]]; then
HOST="localhost"
else
HOST="$1"
fi
@scolton99
scolton99 / gen.fish
Created April 8, 2025 01:39
Certificate Generators
#!/usr/bin/env fish
if test -f ".req.conf"
rm .req.conf
end
set STRBASE "[req]
distinguished_name = dn
x509_extensions = v3_req
prompt = no
@scolton99
scolton99 / test.ps1
Created April 26, 2024 12:35
Test Transient Error Handling in PowerShell
function Get-RandomSuccess {
$val = Get-Random -Maximum 2
$val -eq 0
}
function Get-RandomThrow {
if (!(Get-RandomSuccess)) {
throw "ERR"
}
@scolton99
scolton99 / SWCommon.psm1
Created August 30, 2023 18:36
SolarWinds Rainmeter Widget
class SwisConnection {
[String] $HostName
[Bool] $UseSSL
[Bool] $ValidateSSL
[Int] $Port
[PSCredential] $Credential
SwisConnection(
[String] $HostName,
[Bool] $UseSSL,
@scolton99
scolton99 / cube.js
Created December 4, 2022 14:44
Thing to test random permutations of numbers representing Rubik's Cube arrangements to probabilistically verify possible orientations.
const { Worker, isMainThread, parentPort, workerData } = require('node:worker_threads');
const randIdx = vals => Math.floor(Math.random() * vals.length);
const permute4 = vals => {
const vCopy = [...vals];
if (vCopy.length !== 4)
throw new Error('Array must be of size 4');
@scolton99
scolton99 / archive.js
Created November 18, 2022 19:45
Twitter archive thing NodeJS
const fetch = require("node-fetch");
const { readFileSync, writeFileSync } = require('fs');
const getAccess = async () => {
const refresh_token = readFileSync('last_refresh', { encoding: 'utf-8' });
const data = new URLSearchParams();
data.append('refresh_token', refresh_token);
data.append('grant_type', 'refresh_token');
$TTL 60
$ORIGIN local.example.com.
@ IN SOA examplecom.ddns.net. admin.example.com. {{SERIAL}} 300 900 604800 60
@ IN NS examplecom.ddns.net.
@ IN A {{EXT_IP}}
* IN CNAME examplecom.ddns.net.