Skip to content

Instantly share code, notes, and snippets.

View jweinst1's full-sized avatar
🎯
Focusing

Josh Weinstein jweinst1

🎯
Focusing
View GitHub Profile
#include <string>
#include <cstring>
#include <filesystem>
#include <string>
#include <iostream>
#include <regex>
#include <vector>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
@jweinst1
jweinst1 / hash_merge_tree.cpp
Last active March 10, 2025 02:07
hash merge tree
#include <map>
#include <unordered_map>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cstdint>
#include <ctime>
#include <optional>
@jweinst1
jweinst1 / bloom_hash.cpp
Created February 22, 2025 09:50
A hash map that doesn't resolve collisions and tries to be a bloom filter but gives location and membership info
#include <map>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <ctime>
#include <optional>
#include <chrono>
#include <memory>
@jweinst1
jweinst1 / sorted_string.cpp
Last active February 22, 2025 07:24
a sorted string table in C++
#include <map>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <ctime>
#include <optional>
#include <chrono>
@jweinst1
jweinst1 / direction_sprite_game.html
Created December 23, 2024 23:43
A 16 x 16 sprinte drawer with directions game in JS
<!DOCTYPE html>
<html>
<head>
<title>Runner Game</title>
<style>
canvas { background: #eee;
display: block;
margin: 0 auto;
}
</style>
#include <stdlib.h>
#include <cstdio>
#include <vector>
enum class Color {
Red,
Blue,
Yellow
};
@jweinst1
jweinst1 / unix_dir_iter.cpp
Last active December 12, 2024 01:33
dir iterator with C++ and direct
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
#include <assert.h>
#include <sys/event.h>
#include <sys/time.h>
@jweinst1
jweinst1 / dirmon.c
Last active December 7, 2024 00:03
Mac queue directory monitor with queue
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
#include <assert.h>
#include <sys/event.h>
#include <sys/time.h>
@jweinst1
jweinst1 / cluster.cpp
Last active August 28, 2024 23:18
leaderless consensus
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
//--------system headers -------//
#include <unistd.h>
#include <sys/un.h>
#include <fcntl.h>
@jweinst1
jweinst1 / protocol_bytes.rs
Created August 19, 2024 00:55
rust protocol of bytes for tcp/unix communication
use std::str;
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::{ErrorKind};
use std::time::{Duration, Instant};
const PROT_BYTE:u8 = 1;
const PROT_U32:u8 = 2;
const PROT_U64:u8 = 3;
const PROT_STR:u8 = 4;