Skip to content

Instantly share code, notes, and snippets.

@Codezigineer
Codezigineer / vocab.txt
Created December 11, 2023 19:10
A fast tokenizer
This file has been truncated, but you can view the full file.
the


.
,
of
and
to
@Codezigineer
Codezigineer / PSocket.php
Last active March 25, 2023 21:05
Simpler HTTP Socket server in PHP (Apache, no modules)
<?php
declare(strict_types=1);
$input = fopen("php://input");
class HTTPSocketServer {
public ?callable $onData = null;
private bool $serverStarted = false;
@Codezigineer
Codezigineer / webcomp.sh
Last active February 21, 2023 01:52
webcomp: Very simple WebAssembly compiler based on LLVM 8+
#!/bin/bash
if [[ "$(curl https://gist.github.com/Codezigineer/501c09f8a3114ce7bb32c7d27301650b/raw/webcomp.sh)" != "$(cat $0)" ]]; then
cd "$(dirname $0)"
curl https://gist.github.com/Codezigineer/501c09f8a3114ce7bb32c7d27301650b/raw/webcomp.sh -o webcomp
fi
usage() {
echo "Usage: webcomp [ -f infile ] [ -o outfile ] [ -O0 ] [ -O1 ] [ -O2 ] [ -O3 ] [ -t target {default is wasm32} ] [ -O ]"
}
@Codezigineer
Codezigineer / iSH-emscripten.sh
Last active February 18, 2023 04:09
Emscripten for iSH
apk update
apk add curl git bash zip clang gcc nodejs python3
curl https://codeload.github.com/emscripten-core/emsdk/zip/refs/heads/main -o main.zip
unzip main.zip -d emsdk
cd emsdk
cd emsdk-main
chmod +x emsdk
./emsdk install latest
./emsdk activate latest
@Codezigineer
Codezigineer / Cryptorand.c
Last active February 5, 2023 03:19
Cryptorand.c
#include <stdlib.h>
unsigned char clz32(unsigned int x)
{
return __builtin_clz(x);
};
unsigned char *randomData(unsigned length)
{
unsigned char *array = (unsigned char *)malloc(length);
@Codezigineer
Codezigineer / index.html
Created November 27, 2022 06:54
Tearable Cloth
<canvas id="c"></canvas>
<div id="info">
<div id="top">
<a id="close" href="">&times;</a>
</div>
<p>
<br>- Tear the cloth with your mouse
<br>
<br>- Right click and drag to cut