Skip to content

Instantly share code, notes, and snippets.

View b0mbie's full-sized avatar
🌌

[aka]bomb b0mbie

🌌
  • 07:17 (UTC +02:00)
View GitHub Profile
@dkaraush
dkaraush / oklch2rgb.js
Last active March 4, 2026 23:03
conversion OKLCH into RGB and RGB into OKLCH in js, simplified
const multiplyMatrices = (A, B) => {
return [
A[0]*B[0] + A[1]*B[1] + A[2]*B[2],
A[3]*B[0] + A[4]*B[1] + A[5]*B[2],
A[6]*B[0] + A[7]*B[1] + A[8]*B[2]
];
}
const oklch2oklab = ([l, c, h]) => [
l,
<script>
var module = WebAssembly.instantiateStreaming(fetch("linked_list.wasm"), {});
</script>
@myd7349
myd7349 / Makefile
Created July 13, 2022 05:54 — forked from GavinRay97/Makefile
Dump C/C++ vtable & record layout information (clang + msvc + gcc)
# Requirements:
# clang - The classes/structs you want to dump must be used in code at least once, not just defined.
# MSVC - The classes/structs you want to dump must have "MEOW" in the name for "reportSingleClass" to work.
# Usage:
# $ make dump_vtables file=test.cpp
dump_vtables:
clang -cc1 -fdump-record-layouts -emit-llvm $(file) > clang-vtable-layout-$(file).txt
clang -cc1 -fdump-vtable-layouts -emit-llvm $(file) > clang-record-layout-$(file).txt
g++ -fdump-lang-class=$(file).txt $(file)
cl.exe $(file) /d1reportSingleClassLayoutMEOW > msvc-single-class-vtable-layout-$(file).txt
@rkevin-arch
rkevin-arch / README.md
Last active March 27, 2025 19:57
OneShot Refuge Factory Puzzle Writeup

OneShot Refuge Factory Puzzle Writeup

The problem

If you have not played OneShot yet, go do that RIGHT NOW. It's available on Steam and itch.io, and it's one of my favorite games of all time.

This puzzle appears in the Factory in the Refuge, and is a variant of the game Mastermind. You have 5 lights that you can toggle to either orange, blue, green or red. There's a correct pattern of 5 colors that you're supposed to guess. After you set each light, you can pull a lever, and it will tell you how many lights you got correct. You get 10 attempts before the puzzle resets itself. Depending on the pattern, it can be quite easy or fairly tricky to guess the right pattern.

image ![image](https://user-images.githubusercontent.c

@un-def
un-def / luaversion.lua
Last active December 15, 2025 14:40
A simple function to detect Lua version
local luaversion = function()
if ({false, [1] = true})[1] then -- luacheck: ignore 314
return 'LuaJIT'
elseif 1 / 0 == 1 / '-0' then
return 0 + '0' .. '' == '0' and 'Lua 5.4' or 'Lua 5.3'
end
local f = function() return function() end end
return f() == f() and 'Lua 5.2' or 'Lua 5.1'
end
@sophec
sophec / sockets.h
Last active May 31, 2025 14:54
Cross-platform socket header for both POSIX sockets and Winsock
/*
* File: sockets.h
* Author: Will Eccles
* Date: 2020-03-12
*
* 1. Description
*
* This header attempts to make it easy to use sockets across platforms,
* for both Windows and POSIX systems. While Winsock is often somewhat
* compatible with Berkeley sockets, it is not strictly compatible,
@roccodev
roccodev / hash.rs
Last active May 31, 2025 23:07
Minecraft SHA-1 complement hash calculation in Rust
// Copyright (C) 2019 RoccoDev
// Licensed under the MIT license.
// <https://opensource.org/licenses/MIT>
// Bench results:
// First hash: 152ms
// Second hash: 1ms
// Third hash: 0ms
extern crate crypto; // Tested with 0.2.36
@Ne3tCode
Ne3tCode / proto_defs_parser.js
Created December 23, 2017 20:04
TF2 proto_defs.vpd parser
'use strict';
if (process.argv.length < 4) {
console.log('Usage: node parser.js <input> <output> [proto]');
console.log('Example: node parser.js proto_defs.vpd proto_defs.json path/to/tf_proto_def_messages.proto');
return;
}
const FS = require('fs');
const Protobuf = require('protobufjs'); // v6.8.3
// Djb2 hash function
unsigned long hash(char *str) {
unsigned long hash = 5381;
int c;
while ((c = *str++))
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash % NUM_BUCKETS;
}
@whiler
whiler / echo.lua
Created January 4, 2017 10:14
Simple TCP Echo Server in Lua
local signal = require("posix.signal")
local socket = require("socket")
local string = require("string")
-- create a TCP socket and bind it to the local host, at any port
local server = assert(socket.bind("127.0.0.1", 0))
local ip, port = server:getsockname()
print(string.format("telnet %s %s", ip, port))