Skip to content

Instantly share code, notes, and snippets.

View wrl's full-sized avatar

william light wrl

View GitHub Profile
@wrl
wrl / iso8601.c
Created February 10, 2014 21:34
generating ISO 8601 dates on win32 vs on anything else
/**
* released under http://unlicense.org/
*/
#include <time.h>
#ifdef _WIN32
#include <windows.h>
static void
@wrl
wrl / jprng.h
Created March 2, 2014 21:40
approximating gaussian white noise with equal-distribution random numbers
/**
* code from http://burtleburtle.net/bob/rand/smallprng.html
* "I wrote this PRNG. I place it in the public domain."
*/
#pragma once
#include <stdint.h>
#define JPRNG_RAND_MAX UINT32_MAX
/**
* rutabaga: an OpenGL widget toolkit
* Copyright (c) 2013 William Light.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@wrl
wrl / libedcast.cpp
Created June 27, 2014 13:00
edcast with better float -> int conversion
#define HAVE_FLAC TRUE
/* it doesn't detect I got flac atleast on my system -drr */
#include <math.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
class VstFxProgram
STRUCT_FORMAT = [
'l>', # int32 size
'a4', # int32 fx magic
'l>', # format version
'a4', # vst fx unique id
'l>', # vst fx version
'l>', # nparams
{"version":20140811,"exported":{"from":"0.2.0-bc918a1","on":"2014-10-14T16:12:51+0200"},"programs":[{"level":-6.0,"note_logic":"poly","glide_time":50.0,"pitch_bend_range":2.0,"uncertainty":0.0,"env":{"amp":{"attack":0.002,"decay":0.3,"sustain":-6.0,"release":0.05},"filter":{"attack":0.001,"decay":0.18,"sustain":-90.0,"release":0.001}},"osc":[{"level":0.0,"octave":0.0,"coarse":0.0,"fine":0.0,"phase_shift":0.0,"stereo_separation":0.0,"lsj_amount":0.5,"lsj_y_mult":1.0},{"level":-90.0,"octave":0.0,"coarse":0.0,"fine":0.0,"phase_shift":0.0,"stereo_separation":0.0,"lsj_amount":0.0,"lsj_y_mult":1.0},{"level":-90.0,"octave":0.0,"coarse":0.0,"fine":0.0,"phase_shift":0.0,"stereo_separation":0.0,"lsj_amount":0.0,"lsj_y_mult":1.0}],"lissajous":{"phase_multiplier":1.0,"theta":2.0,"a":1.0,"b":1.0,"osc":{"x":{"octave":0.0,"coarse":0.0,"fine":0.0,"phase_shift":0.0},"y":{"octave":0.0,"coarse":0.0,"fine":0.0,"phase_shift":0.0}},"smoothing":0.0},"filter":{"type":"LP24","cutoff":24000.0,"resonance":0.0,"drive":1.0,"env_mod":0.0}
class LameError < RuntimeError
end
ShibeTest::Suite.new('ShibeTest') do
should_pass 'assert true' do |assert|
assert.true { true }
end
should_fail 'fail assert true' do |assert|
assert.true { false }
use std::env;
use std::path::Path;
extern crate nix;
use nix::fcntl::{O_RDWR, O_NONBLOCK};
use nix::{fcntl,sys};
extern crate mio;
use mio::{TryRead, TryWrite};
#!/bin/dash
path=$(readlink -f "$(which "$0")")
prefix=${path%-*}-
program=${0##*-}
default_cflags="-isysroot /path/to/MacOSX10.<whatever>.sdk"
$program -target x86_64-apple-darwin -B "$prefix" $default_cflags $*
#!/bin/dash
path=$(readlink -f "$(which "$0")")
prefix=${path%-*}-
program=${0##*-}
default_cflags="-isysroot /home/will/macosx_sdks/SDKs/MacOSX10.8.sdk"
$program -target x86_64-apple-darwin -B "$prefix" $default_cflags $*