Skip to content

Instantly share code, notes, and snippets.

View Chase-san's full-sized avatar

Chase-san

  • Detroit, USA
View GitHub Profile
@Chase-san
Chase-san / jenkins.go
Created May 10, 2013 20:41
Jenkins hash function
package jenkins
import "hash"
// Jenkins hash function
type jenkins uint32
func New32() hash.Hash32 {
var j jenkins = 0
return &j;
@Chase-san
Chase-san / Scarlet.ATG
Created May 25, 2013 23:40
Coco/R is somewhat annoying...
COMPILER CompilationUnit
CHARACTERS
tab = '\u0009' .
lf = '\u000a' .
cr = '\u000d' .
digit = "1234567890" .
letter = 'A' .. 'Z' + 'a' .. 'z' + '_'.
@Chase-san
Chase-san / launcher.cpp
Created August 9, 2013 19:33
A simple custom unicode commandline launcher for Java. Converts the argument to hex code.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <windows.h>
/*
* Poor Mans Windows Java Unicode Command Line Passer.
* Easily uses up to 4kb of stack.
*/
@Chase-san
Chase-san / Expr.ATG
Created December 24, 2013 18:04
This is my grammar for my Expression parser. Made for use with Coco/R.
package org.csdgn.expr.coco;
import java.math.BigDecimal;
COMPILER CompilationUnit
public Expr tree;
CHARACTERS
digit
@Chase-san
Chase-san / powersys.cpp
Last active August 29, 2015 13:56
Cataclysm DDA Power System Rough
bool power_plant::has_power(uint64_t time) {
return shutdown_time > time;
}
void power_plant::powerup(uint64_t time) {
//set next shutdown time to 4-12 days in the future
shutdown_time = time + 24 * (4 + (rand() % 8));
for(int i = 0; i < buildings.size(); ++i) {
buildings[i].powerup();
}
@Chase-san
Chase-san / Makefile
Last active August 29, 2015 14:05
Simple Project Makefile (for windows mostly)
SRC_PATH = src
OBJ_PATH = obj
CC = clang
CFLAGS = -std=c11 -Wall -Wpointer-arith -Wwrite-strings -Wuninitialized -pedantic
LDFLAGS = -static-libgcc -lmingw32
TARGET = elsewhere.exe
CFLAGS += -DSDL
@Chase-san
Chase-san / utf8.c
Last active October 13, 2019 10:32
A poor man's conversion from UCS-2/UTF-32 to UTF-8. Has limited support for UTF-16. As it uses wchar_t, this cannot easily be fixed.
/*
Copyright (c) 2014, Robert Maupin <chasesan>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@Chase-san
Chase-san / JRIAC.cs
Last active December 25, 2020 14:22
Space Engineers
/**
* Jackrabbit Industries Automation Controller (JRIAC)
* Version 1.1
*/
// CONSTANTS
const string BlockPrefix = "[Automated]";
//const string GroupPrefix = "[Automated]"; //TODO
// Set Programmable Block screen to 0.4 font size, recommend Monospace font.
@Chase-san
Chase-san / decode.py
Created September 5, 2021 21:25
A python script to decode the hello games no man's sky save files. (The newer compressed kind)
#!/usr/bin/python3
import io
import os
import lz4.block
from glob import glob
FILE_PATH = os.path.dirname(os.path.realpath(__file__))
def uint32(data):
"""Convert 4 bytes to a little endian unsigned integer."""
@Chase-san
Chase-san / nmssavetool.py
Created September 5, 2021 22:08
A tool for de/compressing No Man's Sky save files.
#!/usr/bin/python3
# Copyright 2021, Robert Maupin
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty, provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
import io
import os
import lz4.block