Skip to content

Instantly share code, notes, and snippets.

@Chase-san
Chase-san / nmssavetool.py
Created Sep 5, 2021
A tool for de/compressing No Man's Sky save files.
View nmssavetool.py
#!/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
@Chase-san
Chase-san / decode.py
Created Sep 5, 2021
A python script to decode the hello games no man's sky save files. (The newer compressed kind)
View decode.py
#!/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 / JRIAC.cs
Last active Dec 25, 2020
Space Engineers
View JRIAC.cs
/**
* 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 / utf8.c
Last active Oct 13, 2019
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.
View utf8.c
/*
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 / Makefile
Last active Aug 29, 2015
Simple Project Makefile (for windows mostly)
View Makefile
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 / powersys.cpp
Last active Aug 29, 2015
Cataclysm DDA Power System Rough
View powersys.cpp
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 / Expr.ATG
Created Dec 24, 2013
This is my grammar for my Expression parser. Made for use with Coco/R.
View Expr.ATG
package org.csdgn.expr.coco;
import java.math.BigDecimal;
COMPILER CompilationUnit
public Expr tree;
CHARACTERS
digit
@Chase-san
Chase-san / launcher.cpp
Created Aug 9, 2013
A simple custom unicode commandline launcher for Java. Converts the argument to hex code.
View launcher.cpp
#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 / Scarlet.ATG
Created May 25, 2013
Coco/R is somewhat annoying...
View Scarlet.ATG
COMPILER CompilationUnit
CHARACTERS
tab = '\u0009' .
lf = '\u000a' .
cr = '\u000d' .
digit = "1234567890" .
letter = 'A' .. 'Z' + 'a' .. 'z' + '_'.
@Chase-san
Chase-san / jenkins.go
Created May 10, 2013
Jenkins hash function
View jenkins.go
package jenkins
import "hash"
// Jenkins hash function
type jenkins uint32
func New32() hash.Hash32 {
var j jenkins = 0
return &j;