Skip to content

Instantly share code, notes, and snippets.

Avatar
💖
GITHUB DROP ICE

Cassie Jones porglezomp

💖
GITHUB DROP ICE
View GitHub Profile
@porglezomp
porglezomp / sat.py
Created Jan 14, 2021
A really basic DPLL SAT solver
View sat.py
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 Jan 10, 2021
Send a notification when a long-running command finishes.
View postexec.fish
# 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 Mar 7, 2021
Show your pinned lists in your twitter top bar.
View twitter-pinned-lists.user.js
// ==UserScript==
// @name Twitter Pinned Lists
// @description Show your pinned lists in your twitter top bar.
// @version 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 Sep 28, 2020
A vim syntax definition for HOVALAAG
View hovalaag.vim
" 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 Sep 15, 2020
A script to generate a "Bad Apple" video out of lichess.org chess boards
View process.py
#!/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 Jun 19, 2020
Twitter Alt-Text to Title-Text
View twitter-alt-to-title.js
// ==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 Apr 7, 2020
Load unless there's a segfault
View example.c
// 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 {
@porglezomp
porglezomp / makefile
Created Jan 20, 2020
Convert the "Item Block Heights" video into a summary image
View makefile
# Convert the "Item Block Heights" video into a summary image
# Video: https://www.youtube.com/watch?v=JteRFzrF6U4
# Image: https://twitter.com/porglezomp/status/1219082110704791555
all: abcheight.png
input.mp4:
youtube-dl -f mp4 'JteRFzrF6U4' -o input.mp4
frames: input.mp4
View GroupUniqueId.idr
-- This is a group with a set g, an operation *, and an identity e
record Group g ((*) : g -> g -> g) (e : g) where
constructor MkGroup
-- each of these fields provides a witness of one of the group laws
assoc : (a, b, c : g) -> (a * b) * c = a * (b * c)
ident : (a : g) -> (a * e = a, e * a = a)
inverse : (a : g) -> (b : g ** (a * b = e, b * a = e))
-- Given two groups g1 and g2, with identities e and e', e must be e'
uniquenessOfId : (g1 : Group g o e) -> (g2 : Group g o e') -> e = e'
@porglezomp
porglezomp / rose8.rs
Last active Jan 11, 2020
Rust instructions for ROSE-8
View rose8.rs
// Thanks to Jordan Rose: https://twitter.com/UINT_MIN/status/1215832790958100480
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Op1 {
Zero,
Lsl1,
Lsr1,
Asr1,
Incr,
Decr,