Skip to content

Instantly share code, notes, and snippets.

View porglezomp's full-sized avatar
💖
GITHUB DROP ICE

Cassie Jones porglezomp

💖
GITHUB DROP ICE
View GitHub Profile
@porglezomp
porglezomp / caption-screenshots.lua
Last active January 25, 2024 00:50
Captioned screenshots for MPV
require "mp"
local msg = require "mp.msg"
local utils = require "mp.utils"
-- Currently, I use webp quality=90
-- In the future: Use jxl quality=80
-- It might be nice to adjust the quality on a show-by-show basis
-- The format_json consults metatables to distinguish between empty arrays and lists
local json_object_metatable = { type = "MAP" }
function json_object(obj)
@porglezomp
porglezomp / toggle-player-controls.user.js
Last active November 28, 2022 08:59
Toggle the controls on a video player for easier screenshots.
// ==UserScript==
// @name Toggle Video Controls (f1)
// @version 1
// @include https://archive.org/*
// @include https://www.youtube.com/*
// @grant none
// ==/UserScript==
// LICENSE: CC0 1.0
// Comments with support for more video players are encouraged, if you want to help out
@porglezomp
porglezomp / dracula.py
Last active May 14, 2022 20:28
Tell you what pages of dracula happen on a given day.
#!/usr/bin/env python3
from __future__ import annotations
import abc
import argparse
import datetime
import enum
import re
import sys
@porglezomp
porglezomp / sat.py
Created January 14, 2021 08:54
A really basic DPLL SAT solver
import sys
# (a | b) & (~b | c)
# [[a, b], [~b, c]]
# [[1, 2], [-2, 3]]
# (a | b) & (~b | c) & (b)
# b is true
# (a | T) & (F | c) & (T)
# T & (c) & T
@porglezomp
porglezomp / postexec.fish
Last active January 10, 2021 22:19
Send a notification when a long-running command finishes.
# I have this inside my .config/fish/config.fish, but you migh be able to put it in .config/fish/functions ?
function show_notif --on-event fish_postexec
set -l duration $CMD_DURATION
set -l command $argv
if [ $duration -gt 10000 ]
set -l is_front (osascript -e 'tell application "Terminal" to frontmost')
if [ $is_front != "true" ]
osascript -e "display notification \"Command `$command` finished running after "(expr $duration / 1000)"s\" with title \"Command finished\""
end
end
@porglezomp
porglezomp / twitter-pinned-lists.user.js
Last active November 15, 2021 02:46
Show your pinned lists in your twitter top bar.
// ==UserScript==
// @name Twitter Pinned Lists
// @description Show your pinned lists in your twitter top bar.
// @version 1.1
// @grant none
// @include https://twitter.com/*
// @include https://mobile.twitter.com/*
// ==/UserScript==
// USAGE: Visit your lists page for a few seconds, and this will learn your pinned lists.
@porglezomp
porglezomp / hovalaag.vim
Last active September 28, 2020 19:04
A vim syntax definition for HOVALAAG
" Vim syntax file
" Language: HOVALAAG Assembly
" Maintainer: Cassie Jones
" Latest Revision: 20 September 2020
" See the game at http://silverspaceship.com/hovalaag/
" Get updates at https://gist.github.com/porglezomp/690bb0f75883dc69350174b576ad643f
syntax case ignore
syn match vasmOperator "[+->|&^~]"
@porglezomp
porglezomp / process.py
Last active September 15, 2020 01:44
A script to generate a "Bad Apple" video out of lichess.org chess boards
#!/usr/bin/env python3
# See the finished video at https://youtu.be/HWJhm25RPXA
import functools
import json
import random
import subprocess
import time
from pathlib import Path
from PIL import Image
@porglezomp
porglezomp / twitter-alt-to-title.js
Created June 19, 2020 17:41
Twitter Alt-Text to Title-Text
// ==UserScript==
// @name Twitter Alt-Text to Title-Text
// @description Copy the alt attribute of twitter images into the title attribute, so that I can see the alt text on hover.
// @version 1
// @grant none
// @include https://twitter.com/*
// ==/UserScript==
const SELECTORS =
` .tweet .AdaptiveMedia-photoContainer img
@porglezomp
porglezomp / example.c
Created April 7, 2020 21:26
Load unless there's a segfault
// gcc example.c try_load.c
#include "try_load.h"
#include <stdio.h>
void try_to_load(const uint8_t *address) {
uint8_t value;
if (try_load_u8(address, &value)) {
printf("Successfully load from address %p: %d\n", address, value);
} else {