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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ul << 31) - 1) | |
#define GEN ((1ul << 11) - 1) | |
unsigned | |
fastlog(uint64_t x) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ull << 31) - 1) | |
uint32_t | |
cycle(uint32_t seed, uint32_t prev) | |
{ | |
uint64_t x = prev; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pickle | |
import json | |
def usage(): | |
print("Usage:") | |
print(f"\t{sys.argv[0]} --tojson [PICKLE FILES]") | |
print(f"\t{sys.argv[0]} --topickle [JSON FILES]") | |
JD = json.JSONDecoder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
class stdio_redirect: | |
def __init__(self, stdin=None, stdout=None, stderr=None): | |
self.stdin, self.sys_stdin = stdin, sys.stdin | |
self.stdout, self.sys_stdout = stdout, sys.stdout | |
self.stderr, self.sys_stderr = stderr, sys.stderr | |
def __enter__(self): | |
sys.stdin = self.stdin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
unsigned long long counts[6] = {0}; | |
unsigned long long trials = 0; | |
void | |
roll_dice(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define FIRST(N, ...) (N) | |
#define foreach(X, F, ...) \ | |
for (init_##F(__VA_ARGS__), X = F(FIRST(__VA_ARGS__));\ | |
FIRST(__VA_ARGS__)->_running;\ | |
X = F(FIRST(__VA_ARGS__))) | |
struct count_state { | |
int _running; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from svg import * | |
compose = lambda f: lambda g: lambda *a, **k: f(g(*a, **k)) | |
PURPLE = '#6a1eb0' | |
ORANGE = '#ff824a' | |
BLUE = '#75c1ff' | |
VP_WIDTH = 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#define POOL_NODE_HEADERS struct pool_node *prev, *next | |
struct pool_node { | |
POOL_NODE_HEADERS; | |
}; |