Skip to content

Instantly share code, notes, and snippets.

View ske2004's full-sized avatar
💠
hello

ske ske2004

💠
hello
View GitHub Profile
@ske2004
ske2004 / day17.rs
Created December 17, 2020 15:58
Day 17 AOC
use std::collections::hash_map::*;
use std::time::SystemTime;
#[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)]
struct Vec3(i8, i8, i8);
#[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)]
struct Vec4(i8, i8, i8, i8);
impl Vec4
{
use std::collections::hash_map::*;
fn solve(crule: &RuleCont, rules: &HashMap<usize, Rule>, s: &str, offs: usize) -> (usize, bool)
{
let mut moffs = offs;
match crule
{
RuleCont::Seq(irules) => {
let mut valid = true;
let remoffs = moffs;
use std::collections::btree_set::*;
type Id = usize;
#[derive(Debug)]
pub struct BucketArray<T>
{
items: Vec<T>,
free: BTreeSet<usize>
}
impl<T> BucketArray<T>
#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
@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;
@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 / 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 / _result.md
Last active December 25, 2022 09:03
fizzbuzz in 126 bytes mf

image

@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)
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "../lib.h"
typedef struct {
char *source;
char *dest;
} conn_t;