Skip to content

Instantly share code, notes, and snippets.

--
This format is meant to be very easy to parse, flexible and deterministic. A
section may only be defined once. If multiple are defined using the same
identifier then only the first will be parsed.
Sections are marked by lines beginning with -- <identifier>. Blank identifiers
or ones that aren't searched for will be completely ignored and may contain
anything. Spaces, Tabs, and Newlines (LF, CRLF) are ignored.
Note: the version tag is _required_ to guarantee compatibility - if you don't
@shakesoda
shakesoda / safe_load.lua
Last active December 31, 2015 23:29
shamelessly snagged from lua-l
return {
-- loadstring with function calls disabled. Useful for config files.
safe_load = function(data)
local f = assert(loadstring("return (" .. data .. ")"))
local count = 0
debug.sethook(function()
count = count + 1
if count >= 3 then
error "cannot call functions"
end
@shakesoda
shakesoda / level.py
Created December 4, 2013 00:30
simple rpg-esque leveling system converted to Python (originally Lua)
import math
class Stats:
def __init__(self, base_stats, aptitude):
self._base_stats = dict(base_stats)
self._aptitude = dict(aptitude)
self.level(1)
def __str__(self):
stats = self._stats
@shakesoda
shakesoda / fix-ratings.py
Last active March 6, 2016 22:58
A quick script to fix DDRX ratings in .sm files (difficulty / 1.5). It saves backup files in case something really goes wrong. Place this in the song group you want fixed and run the script, or pass it the folder you want fixed on the command line (i.e. $ fix-ratings.py ~/Songs/Bleh)
#!/usr/bin/env python2
"""
.SM rating fixer thingy!
========================
Usage:
Just put the file in the folder with the things you need fixed and run it!
You can also give it an argument on the command line to specify the path.
@shakesoda
shakesoda / merge.lua
Created November 17, 2013 23:14
util for merging lotsa tables
function merge(t1, t2)
for k,v in pairs(t2) do
if type(v) == "table" then
if type(t1[k] or false) == "table" then
tableMerge(t1[k] or {}, t2[k] or {})
else
t1[k] = v
end
else
t1[k] = v
#extension GL_OES_standard_derivatives : enable
precision highp float;
varying vec2 v_texCoord;
uniform sampler2D texture0;
const float distancethreshold = 0.5;
float aastep(float threshold, float dist)
{
float afwidth = 0.5 * length(vec2(dFdx(dist), dFdy(dist)));
return smoothstep(threshold - afwidth, threshold + afwidth, dist);
@shakesoda
shakesoda / connect.rsm
Created October 29, 2013 06:08
rs... micro? idk, but it doesn't show up as anything known. .rs in json
{
"meta": {
"title": "Connect",
"artist": "ClariS",
"genre": "J-Pop",
"version": 1,
"-sm-banner": "banner.png",
"-sm-background": "background.png"
},
"timing": {
@shakesoda
shakesoda / Makefile
Last active December 26, 2015 16:18
simple gcw zero makefile + package script
CC=mipsel-gcw0-linux-uclibc-gcc
CXX=mipsel-gcw0-linux-uclibc-g++
LIBS=-lGLESv2 -lEGL -Iglm
FLAGS=-Wall -Wextra -fno-strict-aliasing -Og -ggdb -std=c++11 -Wno-missing-field-initializers
OUT=bin/game.bin
FILES=src/*.cpp src/stb_image.c
PACKAGE=gcw-test.opk
all:
@if ! test -d bin; then mkdir bin; fi;
@shakesoda
shakesoda / metrics.ini
Created October 21, 2013 22:21
3d wheel more or less operating
[ScreenSelectMusic]
MusicWheelX=SCREEN_CENTER_X
MusicWheelY=SCREEN_CENTER_Y
MusicWheelOnCommand=draworder,DrawOrder.Overlay;SetDrawByZPosition,true;fov,90
[MusicWheel]
ItemWidth=math.max(math.ceil(SCREEN_WIDTH/3), 220)
ItemHeight=55
ItemOffset=0
ItemTransformFunction=function(self,offsetFromCenter,itemIndex,_numItems) \
@shakesoda
shakesoda / ConvertUTF.c
Created August 23, 2013 09:52
ConvertUTF
/*
* Copyright 2001-2004 Unicode, Inc.
*
* Disclaimer
*
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
* applicability of information provided. If this file has been
* purchased on magnetic or optical media from Unicode, Inc., the