Skip to content

Instantly share code, notes, and snippets.

View learosema's full-sized avatar
👋
Hello World!

Lea Rosema learosema

👋
Hello World!
View GitHub Profile
@learosema
learosema / pngencode.cpp
Created March 8, 2024 00:16 — forked from mmalex/pngencode.cpp
bug fix png encoder
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// VERSION 0.02! now using zlib's crc rather than my own, and avoiding a memcpy and memory scribbler in the old one
// by passing the zero byte at the start of the scanline to zlib first, then the original scanline in place. WIN!
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
@learosema
learosema / pngencode.cpp
Created March 8, 2024 00:15 — forked from anonymous/pngencode.cpp
I just read the png spec, and came up with this as a minimal, zlib based png encoding of a truecolour image with 1-4 channels
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
//
u32 crc_table[256]={0};
void make_crc_table(void)
@learosema
learosema / PATTERN.ASM
Last active December 30, 2023 21:45
VCCC 2023 x86 assembly
org 100h
LINES equ 25
COLS equ 40
section .text
entry: mov ax,0x01
int 0x10
mov di, 0xb800
@learosema
learosema / uniform-struct.test.ts
Created November 8, 2023 10:19
Uniform struct
import { UniformStruct } from "./uniform-struct";
describe('UniformStruct', () => {
it('should create an empty buffer and data structure by default', () => {
const us = new UniformStruct();
expect(us.buffer).toBeInstanceOf(ArrayBuffer);
expect(us.buffer.byteLength).toBe(0);
@learosema
learosema / README.md
Last active October 14, 2023 10:51
leas mastodon recovery notes

Running db backups and or tootctl commands from chroot environment

Wow my server is completely fucked up right now. All I can do is try to create a backup from the most recent data dir... something with dbus daemon prevents from logging me in and it makes everything slow.

# Create mount bindings
mount --bind /dev /repair/dev
mount --bind /dev/shm /repair/dev/shm
mount --bind /dev/pts /repair/dev/pts
@learosema
learosema / PATTERN.ASM
Last active August 27, 2023 16:02
Pseudorandom black and white pattern in DOS
org 100h
section .text
entry: mov ax,0x13
int 0x10
mov di, 0xA000
mov es, di
xor di, di
mov cx, 0xfa00
@learosema
learosema / userscript.js
Last active April 9, 2023 10:04
UserScript: Mark as Grifter site
// ==UserScript==
// @name Mark grifter websites
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Mark Grifter Websitess as grifter websites
// @author Lea Rosema
// @match https://technewsidea.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=technewsidea.com
// @grant none
// ==/UserScript==
@learosema
learosema / jail.local
Last active March 21, 2023 15:56
jail.local
[DEFAULT]
destemail = email@example.org
sendername = Fail2Ban
[sshd]
mode = extra
enabled = true
port = 22
maxretry = 1
bantime=6000
@learosema
learosema / prng.js
Last active May 16, 2023 15:38
eleventy-prng.js
// store this file in the _data directory
let randomSeed = 1234567;
module.exports = {
init(seed) { randomSeed = seed; },
random() {
randomSeed = randomSeed * 16807 % 2147483647;
return randomSeed / 2147483647;
}
};
@learosema
learosema / backgrounds.json
Last active October 9, 2022 17:07
Generative backgrounds for eleventy
[
{
"name": "purple-pink",
"seed": 12,
"color1": "rebeccapurple",
"color2": "deeppink"
},
{
"name": "grayish",
"seed": 432,