Skip to content

Instantly share code, notes, and snippets.

#include <IRremote.h>
#include "Timer.h"
#define CMD_CONST_COLOUR (1 << 4)
#define CMD_FLASH (1 << 5)
#define CMD_ALT (1 << 6)
#define CMD_OFF 0
#define COL_RED_K (1 << 4)
#define COL_GREEN_K (1 << 5)
@biomood
biomood / PerlinNoise.c
Created May 21, 2012 19:04
perlin noise in C, uses lodepng library
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "lodepng.h"
#define WIDTH 400
#define HEIGHT 400
#define PI (3.141592653589793)
int luaopen_screen(lua_State *L) {
luaL_newmetatable(L, SCREENMETA);
luaL_register(L, "screen", screenLib);
return 1;
}
@biomood
biomood / Screen.c
Created March 18, 2012 17:30
Lua library for accessing the framebuffer of a chumby
/*
* A Lua library in C to display interface
* with the chumby frame buffer
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
luaL_newmetatable(L, SCREENMETA);
@biomood
biomood / PagerList.lua
Created March 14, 2012 21:06
Love2D Paged List
local g = love.graphics
PagerList = {
rowsPerPage = 4,
spaceBetweenRow = 44,
initSpace = 24,
noPages = 0,
currentPage = 0,
noRows = 0,
rowsToDisplay = 0,
@biomood
biomood / C_Lua_Chumby
Created January 5, 2012 21:55
Compiling a c lua library on the chumby
gcc -Wall -shared -I/mnt/storag
e/Lua/include/ -L/mnt/storage/Lua/lib/ -llua -lm -ldl -o screen.so screen.c
@biomood
biomood / postify.js
Created November 16, 2011 13:30
Postify method, send complex JSON to MVC
$.postify = function(value) {
var result = {};
var buildResult = function(object, prefix) {
for (var key in object) {
var postKey = isFinite(key)
? (prefix != "" ? prefix : "") + "[" + key + "]"
: (prefix != "" ? prefix + "." : "") + key;
@biomood
biomood / cLua
Created October 2, 2011 19:44
Compiling C functions to be called from lua
gcc -Wall -shared -I/usr/local/include/ -L/usr/local/lib/ -llua -o serial.so serial.c
@biomood
biomood / MeggyJrGameOfLife.c
Created September 18, 2011 21:15
Conway's game of life for the Meggy Jr
#include <stdlib.h>
#include <MeggyJrSimple.h>
byte screen[8][8] = {{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},