Skip to content

Instantly share code, notes, and snippets.

View rasmusmerzin's full-sized avatar
🎮

Emil Rasmus Merzin rasmusmerzin

🎮
View GitHub Profile
// nolib ANSI RNG
export const m = 2 ** 31; // just outside of i32
export const a = 1103515245;
export const c = 12345;
// returns integer [0; 2 ** 31 -1]
export function rand(seed: number): () => number {
return () => (seed = (a * seed + c) % m | 0);
}
@keyframes bg {
0% {
background-position: var(--x0) var(--y0);
}
33% {
background-position: var(--x1) var(--y1);
}
66% {
background-position: var(--x2) var(--y2);
}
#!/usr/bin/env bash
for arg in "$@"
do
printf '__bashfmt__(){\n%s\n}\ntype __bashfmt__' "$(cat "$arg")" |
bash | sed -n 's/^ \(.*\)$/\1/p'
done

Given

Port: 18181
Receiver address: 192.168.1.111

Sender

ffmpeg -f pulse -i remote.monitor -ac 2 -acodec pcm_u8 -ar 48000 -f u8 udp://192.168.1.111:18181

Cryptsetup LUKS

Given:

  • partition /dev/sda1
  • mapping secrets
  • mountpoint /mnt

Init

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@rasmusmerzin
rasmusmerzin / build.zig
Last active May 4, 2023 07:34
ABI Zig 🔗 Typescript
// see https://gitlab.com/merzin/mono/-/tree/mono/abi
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const mode = b.standardReleaseOptions();
const lib = b.addSharedLibrary("index", "index.zig", b.version(0, 0, 0));
lib.setBuildMode(mode);
lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
lib.setOutputDir("zig-out");
@rasmusmerzin
rasmusmerzin / lock-map.test.ts
Last active May 29, 2022 06:48
Typescript LockMap<T>
import { LockMap, LockMapEvent } from "./lock-map";
const { Release, Change, Acquire } = LockMapEvent;
describe("LockMap<void>", () => {
let events: LockMapEvent[];
let lockSet: LockMap<void>;
beforeEach(() => {
events = [];
Section "InputClass"
Identifier "Coordinate Transformation Matrix"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
MatchDriver "libinput"
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
EndSection
Section "Monitor"
Identifier "Monitor0"