Skip to content

Instantly share code, notes, and snippets.

@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": {
#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 / 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
@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 / 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 / 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
--
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 / waveframe.rsm
Created January 8, 2014 19:22
WaveFrame's RS format spec
waveframe's .rs format
----------------------
Waveframe's implementation of the .rs format is nothing more than a specific
definition of what Waveframe looks for. It may or may not match shakesoda's
wishes for the format, though it tries to stay as close to the spec as possible.
=={ Standard Sections }==
These standard sections may include nonstandard elements.
See each section's intro text for more information.
@shakesoda
shakesoda / ouya_mappings.txt
Created January 9, 2014 05:32
Ouya controller mappings (Android + SDL2 + Love2D)
D-Pad Up 1
D-Pad Down 2
D-Pad Left 3
D-Pad Right 4
O 6
U 9
Y 10
A 7
local _lfsgdi = love.filesystem.getDirectoryItems or love.filesystem.enumerate
function love.filesystem.getDirectoryItems(dir, callback)
if not callback then
return _lfsgdi(dir)
else
local files = _lfsgdi(dir)
for i, path in ipairs(files) do
callback(path)
end
end