Skip to content

Instantly share code, notes, and snippets.

Avatar

Julian saucecode

View GitHub Profile
View discorddecode.py
import base64, zlib, sys, os, json
inflator = zlib.decompressobj()
bins = sorted([i for i in os.listdir('.') if i.endswith('.in.bin')], key=lambda j:int(j[:-7]))
pretty_print = True
# go through all the *.in.bin files, decompress them sequentially
# and write them to *.in.json files. Optionally pretty print
# them (switch the variable above)
@saucecode
saucecode / linkedlists.c
Created Jun 15, 2019
example linked lists implementation
View linkedlists.c
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int x;
int y;
float health;
} monster_t;
typedef struct {
View velocity-constraints.patch
From d2ef1e5505a7b3e9b3ad393df344b3cda5e2ad09 Mon Sep 17 00:00:00 2001
From: Julian <cahill.julian@gmail.com>
Date: Tue, 18 Dec 2018 03:34:32 +1300
Subject: [PATCH] added locking of linear and angular velocities with
RigidBody::setLinearVelocityFactor(), RigidBody::setAngularVelocityFactor()
---
src/body/RigidBody.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++-
src/body/RigidBody.h | 42 +++++++++++++++++++++++++++++++++++++----
src/engine/DynamicsWorld.cpp | 14 +++++++++++++-
@saucecode
saucecode / Game.cpp
Created Jun 26, 2018
attempt at porting mattdesl's 2d pixel perfect shadows
View Game.cpp
#include "Game.hpp"
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
@saucecode
saucecode / aoc16.py
Created Dec 16, 2017
awful and unclean solution
View aoc16.py
with open('day16challengeinput','r') as f:
data = f.read().split(',')
moves = []
for move in data:
if move[0] == 's':
moves.append( (0, int(move[1:])) )
elif move[0] == 'x':
@saucecode
saucecode / aoc10_part2.c
Created Dec 10, 2017
AoC Day 10 Part 2 solution in C
View aoc10_part2.c
#include <stdio.h>
#include <stdlib.h>
typedef struct {
void *prev;
void *next;
int value;
} Node;
Node* assembleRingNodes(int *nodeValues, int len){
@saucecode
saucecode / aoc8_ugly.py
Created Dec 8, 2017
AoC day 8 feat. the ugliest code I've ever written -- script generates scripts that generate solutions to both parts
View aoc8_ugly.py
# generates a python script which runs the challenge input as code then prints out
# the largest integer in `locals()` and the largest value seen
with open('day8challengeinput','r') as f:
lines = f.read().split('\n')
def generate_code_from_input():
headcode = 'largest = 0'
excode = ''
symbols = []
@saucecode
saucecode / AoC7Solution.java
Created Dec 7, 2017
AoC day 7 part 2 solution
View AoC7Solution.java
import java.io.File;
-snip-
public class AoC7Solution {
static List<Node> nodes = new ArrayList<>();
public static void main(String[] args) {
// Read input
try {
@saucecode
saucecode / aoc4.2.py
Created Dec 4, 2017
my AoC day 4 part 2 prime-products solution
View aoc4.2.py
import string
challenge = '''nyot babgr babgr kqtu kqtu kzshonp ylyk psqk
iix ewj rojvbkk phrij iix zuajnk tadv givslju ewj bda
-snip-
'''.split('\n')
primes = [int(x) for x in '2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101'.split(', ')]
letters = string.ascii_letters[:26]
@saucecode
saucecode / aoc3.c
Created Dec 3, 2017
my C99 solution to advent of code 2017 day 3 part 2
View aoc3.c
#include <stdint.h>
#include <stdio.h>
#include <string.h>
// returns the sum of all 8 adjacent cells to element [cy][cx] in a 2D array, with bounds checking
uint32_t setdata(uint32_t root_max, uint32_t data[][root_max], uint32_t cx, uint32_t cy){
uint32_t counter = 0;
if(cx + 1 < root_max){
counter += data[cy][cx+1];
if(cy - 1 >= 0)
You can’t perform that action at this time.