Skip to content

Instantly share code, notes, and snippets.

View ske2004's full-sized avatar
💠
hello

ske ske2004

💠
hello
View GitHub Profile
@ske2004
ske2004 / main.c
Created May 16, 2022 11:45
UNICODE PARSER
// vim: noet
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
size_t th_utf8_decode_beta(uint32_t *out, const char *s_) {
const unsigned char *s = (const unsigned char*)s_;
if ((*s & 0xC0) != 0xC0) {
*out = *s;
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdbool.h>
#include <math.h>
#include "../lib.h"
typedef enum {
SHUT,
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "../lib.h"
typedef struct {
char *source;
char *dest;
} conn_t;
@ske2004
ske2004 / day6.c
Last active December 7, 2021 14:08
#include <stdio.h>
#include <inttypes.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
char* read_file(const char *path) {
FILE *f = fopen(path, "rb");
if (f == NULL)
@ske2004
ske2004 / _result.md
Last active December 25, 2022 09:03
fizzbuzz in 126 bytes mf

image

@ske2004
ske2004 / compiler.py
Created October 23, 2021 12:55
GARBAGESCRIPT
instructions = []
f = open("input.grs", "r")
src = str(f.read())
f.close()
def var_emit(line):
name = line[1:].strip()
instructions.append(["MAKEVAR", name])
@ske2004
ske2004 / sb.c
Created September 5, 2021 19:42
#include "builder.h"
//
// Begins construction of string
//
struct StringBuilder sbstart() {
return (struct StringBuilder) {
.str = NULL,
.size = 0,
.capacity = 0
@ske2004
ske2004 / obj.h
Created September 5, 2021 12:40
obj parser
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
typedef struct {
const char *src;
} _obj_Parser;
#include "particle_system.h"
#include "camera.h"
#include <SDL2/SDL_render.h>
#include <stdint.h>
static int particle_rand(u32 *seed) {
return (((*seed = *seed * 214013L + 2531011L) >> 16) & 0x7fff);
}
/// Create partcile system
use std::collections::btree_set::*;
type Id = usize;
#[derive(Debug)]
pub struct BucketArray<T>
{
items: Vec<T>,
free: BTreeSet<usize>
}
impl<T> BucketArray<T>