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 os | |
import sys | |
""" | |
This (pure!) python script streams a gzip-compressed YUV4MPEG video to stdout. | |
It easily runs at 1080p60fps on my machine. | |
Pipe it into a media player like this: | |
python3 gzip_swar_life.py | mbuffer | gunzip - | mpv - |
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
CFLAGS := -Wall -Wextra -Wpedantic -O3 | |
CXXFLAGS := ${CFLAGS} | |
LDFLAGS := -lsimdutf | |
main: main.o utf8_incremental.o |
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
""" | |
DISCLAIMER: This is a quick prototype, it's not at all tested, and may be deeply cryptographically flawed. | |
Normally, JSON canonicalization is at least O(nlogn), because you need to sort the map keys. | |
This approach avoids the need to do that, and in theory it's O(n), but in practice it's probably slower for most inputs... I have not benchmarked. | |
If you limit recursion depth, you could implement it as an Online Algorithm https://en.wikipedia.org/wiki/Online_algorithm | |
NB: Python's JSON parser allows duplicate map keys, which this impl will be oblivious to. |
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
/* | |
gcc main.c -o main -O3 -lSDL2 | |
This hits 240fps at 4K resolution, on my M1 Pro | |
*/ | |
#include <SDL2/SDL.h> | |
#include <stdio.h> |
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
#!/usr/bin/python3 | |
import sys | |
import os | |
import signal | |
PATTERN = b"root:x:0:0:root" | |
REPLACE = b"root::00:0:root" |
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 zlib | |
from io import BytesIO | |
# TODO: make this shorter | |
RLEFLATE_MAGIC = b'\xed\xe3\t\x90$I\x92$I\xcc\xff\xff\xff\xff\xff\xff\xff\xff'\ | |
b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'\ | |
b'\xff\xff\xff\xff?3333\xe1\x0e\x00\x0e``\xa0\xaa*"\xc2\xdc]U\x04\x00\x80' | |
RLEFLATE_EOF = b'\x77' | |
RLEFLATE_REPEAT = [ | |
None, b'W', b'7', b'G', b'g', b'#', b'3', b'+', b';', b'\x11', b'Q', |
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 io | |
import base64 | |
import struct | |
import hashlib | |
import asyncio | |
import websockets | |
from enum import Enum | |
# ground control to major type |
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
// ==UserScript== | |
// @name Fake Widevine | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Fake the presence of a functional Widevine CDM - enough to get the spotify UI to launch, so you can pick another playback device. | |
// @author David Buchanan | |
// @match https://open.spotify.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=spotify.com | |
// @grant none | |
// ==/UserScript== |
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
NUCLEAR WASTE SOFTWARE LICENSE V1.0 | |
Copyright <YEAR> <OWNER> | |
This software license is a message... and part of a system of messages... | |
pay attention to it! Writing this software and associated documentation | |
files (the "Software") was important to us. We considered ourselves to be a | |
powerful culture. This Software is not a place of honor... no highly | |
esteemed deed is commemorated here... nothing valued is here. What is here was | |
dangerous and repulsive to us. This message is a warning about danger. The |
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
#!/usr/bin/env python3 | |
import os | |
""" | |
Cursed Code. | |
This code literally patches your kernel memory, proceed at your own risk. | |
Tested on Ubuntu 17.10 and Arch, x86_64. Should work on other distros, maybe even other architectures! |