Skip to content

Instantly share code, notes, and snippets.

View shmup's full-sized avatar
🐌

Jared Miller shmup

🐌
View GitHub Profile
@shmup
shmup / vpet.c
Last active January 21, 2025 18:32
gcc -o vpets vpets.c -lX11 -lXext
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/shape.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
#!/usr/bin/env python3
from flask import Flask, request, redirect, url_for
from markupsafe import escape
import re
import json
import atexit
from urllib.parse import urlparse
app = Flask(__name__)
@shmup
shmup / compose.yml
Created January 11, 2025 21:08
volume mounts
# simple bind mount - directly maps host directory to container
# pro: simple, direct
# con: less docker-native management
volumes:
- /opt/medusa/postgres:/var/lib/postgresql/data
# named volume with bind properties - docker managed but host-accessible
# pro: docker volume features (named reference, metadata, drivers)
# con: more verbose, possibly overengineered for simple needs
volumes:
@shmup
shmup / owned
Created December 25, 2024 22:09
lol owned
owned
@shmup
shmup / userChrome.css
Created December 14, 2024 17:41
userChrome.css for Firefox that reduces tab height and adds dynamic opacity
/* userChrome.css */
/*
* modifications:
* - reduces the height of the tab bar
* - sets tab bar opacity to 0
* - on hover or url bar focus, set opacity to 1
*/
/* variables */
@shmup
shmup / edge2desktop
Created December 6, 2024 20:49
makes the ms edge "desktop" apps convenient for launchers
#!/usr/bin/env bash
FORCE=0
while getopts "f" opt; do
case $opt in
f) FORCE=1 ;;
*)
echo "Usage: $0 [-f]"
exit 1
;;
# core settings
scrollwidth 0
scrollbg b0b0b0
scrollfg 808080
stylehint 1
safeclicks 1
cols 60
rows 25
fullscreen 0
zoom 1.5
@shmup
shmup / scheduling.md
Created October 22, 2024 14:42
scheduling strats

Strategy 1: Least Common Multiple (LCM) Cycle

Explanation: Calculate LCM of all intervals to create a cycle. Within the cycle, schedule each announcement at multiples of its interval. Prevent overlaps by assigning the earliest available slot.

Code:

const moment = require('moment');

const SCHEDULED_ANNOUNCEMENTS = [/* as defined */];
@shmup
shmup / slurpfiles.vim
Last active October 28, 2024 23:54
vim command to aggregate buffer contents with their file path/name
vim9script
# slurpfiles.vim
# aggregate buffers into a new buffer and copy to system clipboard
# :Slurp to aggregate all buffers into a new buffer
# :Slurp -t or --tab-only to only aggregate current tab's buffers
# :Slurp -b or --buffer-dir to aggregate all files in the current buffer's directory
# :Slurp -w or --working-dir to aggregate all files in the current working directory
def SlurpBuffers(...args: list<string>)