Skip to content

Instantly share code, notes, and snippets.

View shmup's full-sized avatar
🐌

Jared Miller shmup

🐌
View GitHub Profile
@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>)
@shmup
shmup / slurpfiles
Created October 12, 2024 18:23
slurpfiles
#!/usr/bin/env python3
"""
This script concatenates files in a directory and prints the content.
The filename and relative path is atop each text blob.
$ slurpfiles /optional/path
$ slurpfiles -r /path/with/nested/dirs
$ slurpfiles --ignore *.css *.txt /path
$ slurpfiles -o path/to/foo.js path/to/another/thing.js
@shmup
shmup / toggle-mind
Last active September 23, 2024 17:32
Toggle typingmind
#!/usr/bin/env bash
# example for i3 config: bindsym $mod+Shift+m exec toggle-mind
APP_NAME="TypingMind -"
APP_LAUNCH_COMMAND="microsoft-edge --app=https://www.typingmind.com"
LAUNCH_SLEEP=2
launch_app() {
eval "$APP_LAUNCH_COMMAND" &
@shmup
shmup / paste.vim
Created February 18, 2024 21:18 — forked from romainl/paste.vim
Sharing is caring
" Mac OS X (requires curl)
" ------------------------
command! -range=% SP <line1>,<line2>w !curl -F 'sprunge=<-' http://sprunge.us | tr -d '\n' | pbcopy
command! -range=% CL <line1>,<line2>w !curl -F 'clbin=<-' https://clbin.com | tr -d '\n' | pbcopy
command! -range=% VP <line1>,<line2>w !curl -F 'text=<-' http://vpaste.net | tr -d '\n' | pbcopy
command! -range=% PB <line1>,<line2>w !curl -F 'c=@-' https://ptpb.pw/?u=1 | tr -d '\n' | pbcopy
command! -range=% IX <line1>,<line2>w !curl -F 'f:1=<-' http://ix.io | tr -d '\n' | pbcopy
command! -range=% EN <line1>,<line2>w !curl -F 'file=@-;' https://envs.sh | tr -d '\n' | pbcopy
command! -range=% XO <line1>,<line2>w !curl -F 'file=@-' https://0x0.st | tr -d '\n' | pbcopy
command! -range=% TB <line1>,<line2>w !nc termbin.com 9999 | tr -d '\n' | pbcopy
@shmup
shmup / perms.txt
Last active February 6, 2024 00:38
linux perm/group/selinux notes
█▓▒░ PERMISSION THINGS ░▒▓█
chgrp pissgroup file | change file's group to pissgroup
chmod 755 directory | set r/w/execute for owner, r/execute for group and others on dir
chown username:groupname file | change owner and group of file
getent group wheel | list all users of a group
gpasswd -a username piss | add user to the group piss (alternative)
gpasswd -d username piss | remove user from the group piss
groupadd piss | create a new group named piss
groupdel piss | delete the group named piss
@shmup
shmup / moolist
Last active January 27, 2024 17:18
quickly run any of the breathing moos on moolist.com with tt++
#!/usr/bin/env bash
# quickly run any of the breathing moos on moolist.com with tt++
# requires: curl, fzy (or fzf but update script), tt++
# https://asciinema.org/a/633014
set -euo pipefail
html_content=$(curl -s 'https://moolist.com/all.php')
telnet_uris=$(
@shmup
shmup / Caddyfile
Created January 7, 2024 23:36
streaming with srs and ffmpeg
:8888 {
root * /crypt
file_server browse
@tsFiles {
path *.ts
}
header @tsFiles Content-Type video/MP2T
log {
output stdout
}
#!/usr/bin/env bash
player="cvlc --loop"
track="https://dev.host/~shmup/tmp/Melancholia_I.mp3"
aquarium="http://asciiquarium.live"
reset() {
tput cnorm; stty echo; tput sgr0; clear
}
@shmup
shmup / Search my gists.md
Created December 19, 2023 04:41 — forked from santisbon/Search my gists.md
How to #search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html