Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <Windows.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#define STB_IMAGE_WRITE_IMPLEMENTATION
@RJ-Infinity
RJ-Infinity / murmur_hash3.c3
Created March 10, 2025 22:44
this is a c3 port of the murmur hash 3 that i didnt end up using for a project but it felt a shame to just delete it so i put it here
// This code has been ported from the original (https://github.com/aappleby/smhasher/) to c3
import ntypes;
//-----------------------------------------------------------------------------
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
// Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
@RJ-Infinity
RJ-Infinity / referenced_task.py
Created September 20, 2024 17:38
this decorator creates a task which automaticly starts when called and then can be awaited later or never at all and it will still continue running
from asyncio import create_task, Future
from functools import wraps
# this is needed as the create_task only holds a weak reference to the task so it could be garbage collected
_running_tasks = {}
def _get_id():
i=0
yield i
while True:
i+=1
@RJ-Infinity
RJ-Infinity / canvasTextWrap.js
Created July 16, 2024 18:36
a js file for rendering text into a canvas with line wrapping.
CanvasRenderingContext2D.prototype._textWrap = function(text, x, y, width, renderTextFn){
let size = this.measureText(text);
let height = size.fontBoundingBoxDescent + size.fontBoundingBoxAscent
if (size.width > width){
let words = text.split(" ").reverse();
let thiswords = [];
do{
thiswords.push(words.pop());
size = this.measureText(thiswords.join(" "))
}while (size.width < width);
CONHOST command line arguments
this information may be out of date as microsoft has said that they will not keep this consistent
all the information i found by experementing and reading the source at https://github.com/microsoft/terminal
server handle token (accepted two ways)
--server 0x4 (new method)
0x4 (legacy method)
the arguments must contain only one of these
--signal <arg:short as handle>
an optional file handle that will be used to send signals into the console.
This represents the ability to send signals to a *nix tty/pty
@RJ-Infinity
RJ-Infinity / memAlloc.js
Last active April 30, 2023 23:04
a realy basic memory allocator for wasm
/* (c) RJ_Infinity
i cant be borthered to find a proper license so just be sensible when using it and give me credit thanks
*/
class memAlloc{
static DEBUG = false
memAllocs={};
freeMem={};
setMemory(memory){this.memory = memory;}
alloc(size){