Skip to content

Instantly share code, notes, and snippets.

#define FORMAT(str) \
{ \
va_list va; \
char staticbuf[1024]; \
char *buf = staticbuf; \
va_start(va, in); \
unsigned int need = vsnprintf(buf, sizeof(staticbuf), in, va) + 1; \
if (need > sizeof(staticbuf)) \
{ \
/* staticbuf wasn't large enough, malloc large enough */ \
@shakesoda
shakesoda / install-server.sh
Created December 11, 2011 02:11
quick craftbukkit setup
#!/bin/bash
BINDIR=/Users/`whoami`/minecraft
mkdir $BINDIR
cd $BINDIR
# download latest craftbukkit
curl -O http://ci.bukkit.org/job/dev-CraftBukkit/lastSuccessfulBuild/artifact/target/craftbukkit-1.0.0-SNAPSHOT.jar
@shakesoda
shakesoda / steps.rs
Created December 8, 2011 02:53
RS format spec (WIP)
--
This format is designed 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
require 'rmagick'
#
# simple mandelbrot set using imagemagick
#
# settings
maxIterations = 50
factor = 256.0
# shakesoda's xorg.conf with modelines for 640x480 and 800x600 arcade monitors
# tested with a Makvision M2929D4G-TS (h freqs 30-40KHz, v freqs 47-90Hz)
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
@shakesoda
shakesoda / add-events.js
Created October 21, 2011 20:52
JavaScript: This is what I get for not wanting to repeat myself.
/*
* Example usage:
* addEvents(document, {
* load: [ foo, bar ],
* click: baz
* })
*/
function addEvents(obj, list, evt) {
function isArray(value) {
return (value instanceof Array)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dogwalk" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="10"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".KevinWynneScheduleActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="adnroid.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>