Skip to content

Instantly share code, notes, and snippets.


Louis Warren louisswarren

View GitHub Profile

ffmpeg notes

I often want to do something that I believe is non-trivial in ffmpeg, only to discover that it is actually very simple, if only I had known how to do it. I even end up writing wrappers to do simple things, because I keep forgetting what to do. However, this file is my new solution: simply write my own documentation for things I would occasionally like to do.

louisswarren / pool.c
Created May 11, 2021
Linked list pool
View pool.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#define POOL_NODE_HEADERS struct pool_node *prev, *next
struct pool_node {
louisswarren / findunicode.c
Last active May 5, 2021
Strip unicode (why was this tricky in php?)
View findunicode.c
#include <stdio.h>
#define BUF_SZ (1 << 16)
find_unicode(char *p, size_t n)
size_t i;
for (i = 0; i < n; ++i) {
if (p[i] & 128)
louisswarren / Makefile
Last active May 4, 2021
Pipe pattern drawing
View Makefile
CFLAGS += -Ofast
.PHONY: default
default: refactor
.PHONY: refactor
refactor: out.pbm
sha256sum $< | diff -q goal.sum -
refactor-set: out.pbm
louisswarren / Makefile
Last active May 3, 2021
Tiny library for PPM output
View Makefile
.PHONY: test test-video
test: nz.png
sxiv $^
test-video: fire
./fire | mpv --no-correct-pts --fps=30 --scale=oversample -
%.png: %.ppm
convert $< $@
louisswarren / Makefile
Last active Apr 30, 2021
Key expansion
View Makefile
.PHONY: default
default: keys
keys: CFLAGS += -lcrypto
louisswarren / wtype.agda
Last active Apr 26, 2021
W-types in agda
View wtype.agda
-- Based on
data W (S : Set) (P : S Set) : Set where
_◁_ : (s : S) (P s W S P) W S P
data 𝟘 : Set where
data 𝟙 : Set where
: 𝟙
louisswarren / Makefile
Last active Apr 26, 2021
Menger sponge sides
View Makefile
.PHONY: default
default: menger8.png
%.png: %.pbm
convert $^ $@
menger%.pbm: menger
./$^ $* > $@
louisswarren / list.c
Last active Apr 7, 2021
Ordered lists in C
View list.c
#include <stdio.h>
#include <stdlib.h>
struct list_entry {
struct list_entry *next;
int value;
struct list {
struct list_entry *head;
#!/usr/bin/env python3
import itertools
import json
import subprocess
import sys
import urllib.request
user = 'louisswarren'