Skip to content

Instantly share code, notes, and snippets.

View DexterHaslem's full-sized avatar
💭
why are you taking advice from a site that goes down weekly?

Dexter M Haslem DexterHaslem

💭
why are you taking advice from a site that goes down weekly?
View GitHub Profile
@DexterHaslem
DexterHaslem / smcleanup.sh
Last active February 8, 2024 17:45
delete empty old rooms from matrix synapse
#!/bin/bash
# cleanup empty matrix synapse rooms -
# the matrix synapse admin experience is a total joke, barely above 'idk figure it out, ere are some apis'
# with that said this script will automatically purge all rooms with no users left in them which hang around in the
# db by default because that totally makes sense
# this is your synapse admin endpoint. in this example its localhost to avoid reverse proxy timeouts/etc
# this is mostly from calling the old v1 delete before which was synchronous and slow.
# beware the nginx etc reverse proxy settings in the docs DO NOT expose admin endpoint
@DexterHaslem
DexterHaslem / cm1000.py
Last active April 6, 2023 15:59
CM1000 modem log scraper thing
## this is a quick and dirty script to remotely login to a Netgear CM1000 modem,
# grab the docsis logs and format them as a csv for saving later. the webpage will only show so many
# and logs can be eventually be lost. this is also an easier way to grab/view them
# last tested on Firmware Version V7.01.01 jan 2 2022
import requests
import re
from time import time
from csv import DictWriter
from xml.dom.minidom import parseString
from datetime import datetime
C:\Users\D\Documents\cocainediesel>ggbuild\lua.exe ggbuild\ninja_timeline.lua
cgltf.cpp [>>>>>>>>>>>>>>>>>>] 0.46s
ggentropy.cpp [>>>>>>>>>>>>] 0.31s
ggformat.cpp [>>>>>>>>>>>>] 0.31s
ggtime.cpp [>>>>>>>>>>>>>] 0.35s
glad.cpp [>>>>>>>>>>>>>>>>>>>>>>>>>] 0.61s
imgui.cpp - [>>>>>>>>>>>>>>>>>>>>>>>>>>>] 0.64s
imgui_demo.cpp [>>>>>>>>>>>>>>>>] 0.41s
imgui_draw.cpp - [>>>>>>>>>>>>>>] 0.36s
imgui_freetype.c [>>>>>>>>>>>>>>>] 0.39s
F:\cocainediesel>ggbuild\ninja.exe
[31/191] source/cgame/cg_events.cpp
F:\cocainediesel\source\cgame\cg_events.cpp(1021): warning C4389: '!=': signed/unsigned mismatch
[128/191] source/gameshared/gs_pmove.cpp
F:\cocainediesel\source\gameshared\gs_pmove.cpp(625): warning C4310: cast truncates constant value
F:\cocainediesel\source\gameshared\gs_pmove.cpp(627): warning C4310: cast truncates constant value
[188/191] server.exe
FAILED: server.exe
link /OUT:server.exe build/windows-debug/source/game/gt_bomb.cpp.obj build/windows-debug/source/game/gt_gladiator.cpp.obj build/windows-debug/source/game/gt_utils.cpp.obj build/windows-debug/source/game/g_ai.cpp.obj build/windows-debug/source/game/g_callvotes.cpp.obj build/windows-debug/source/game/g_chase.cpp.obj build/windows-debug/source/game/g_clip.cpp.obj build/windows-debug/source/game/g_cmds.cpp.obj build/windows-debug/source/game/g_combat.cpp.obj build/windows-debug/source/game/g_frame.cpp.obj build/windows-debug/source/game/g_func.cpp.obj build/windows-debug/sou
#include <xc.h>
#pragma config FOSC = INTOSC // Oscillator Selection bits->INTOSC oscillator: CLKIN function disabled
#pragma config BOREN = ON // Brown-out Reset Enable->Brown-out Reset enabled
#pragma config WDTE = ON // Watchdog Timer Enable->WDT enabled
#pragma config PWRTE = OFF // Power-up Timer Enable bit->PWRT disabled
#pragma config MCLRE = ON // MCLR Pin Function Select bit->MCLR pin function is MCLR
#pragma config CP = OFF // Code Protection bit->Program memory code protection is disabled
#pragma config LVP = ON // Low-Voltage Programming Enable->Low-voltage programming enabled
#pragma config LPBOR = ON // Brown-out Reset Selection bits->BOR enabled
@DexterHaslem
DexterHaslem / asdf.ino
Last active August 20, 2022 21:48
throwaway voltage runtime set and forget timer
// simple voltage babysitter. hook up eg battery or a dcdc output to d7 to get total minutes
// it was digital high. this is useful to see effective runtime of a battery fed boost buck system etc
#define BAT_PIN (7)
#define DEGLITCH (5)
static unsigned int on_minutes = 0;
static unsigned char c = 0;
void setup() {
Serial.begin(9600);
#!/usr/bin/fish
set ext ".demo"
set prev (date -d "-1 month" +%Y-%m)
cd ~/cdserver/demos/server
mkdir -p $prev
mv $prev*$ext $prev
# cron it
# 0 0 1 * * fish organize-demos.fish
@DexterHaslem
DexterHaslem / main.c
Created June 17, 2022 02:21
steamworks api init / dummy
#include <Windows.h>
#pragma warning(disable:4996)
#include "steam/steam_api_flat.h"
int main(int argc, char** argv) {
SteamAPI_Init();
while (GetAsyncKeyState(VK_ESCAPE) == 0) {
Sleep(100);
}
@DexterHaslem
DexterHaslem / intercept-xhr.js
Created June 7, 2022 04:30
Intercept XHR requests so that we can do something useful with it.
// Taken from https://stackoverflow.com/a/27363569
// Allows for the object to be interrogated
((() => {
const origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
console.log('request started!');
this.addEventListener('load', function() {
console.log('request completed!');
console.log(this.readyState); //will always be 4 (ajax is completed successfully)
@DexterHaslem
DexterHaslem / gist:3ed3d0079e06f699fdafcc9e852508d0
Last active February 17, 2022 04:27
sunxi-fel fixes (A10, A20 etc)
Allwinner sunxi-tools timeout fix .. tried bot xhci and ehci switching bios settings with no luck
(A10, A20 olimex boards tested)
[ 533.679976] new full-speed USB device number 7 using xhci_hcd
[ 533.679976] usb 2-8: New USB device found, idVendor=1f3a, idProduct=efe8, bcdDevice= 2.b3
[ 533.679981] usb 2-8: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 597.256368] usb 2-8: USB disconnect, device number 7
[ 385.247362] usb 4-1.1: new full-speed USB device number 19 using ehci-pci