Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / README.md
Created February 23, 2014 13:57 — forked from mbostock/.block

Mitchell’s best-candidate algorithm generates a new random sample by creating k candidate samples and picking the best of k. Here the “best” sample is defined as the sample that is farthest away from previous samples. The algorithm approximates Poisson-disc sampling, producing a much more natural appearance (better blue noise spectral characteristics) than uniform random sampling.

See also the white-on-black and Voronoi variations of this example.

@roxlu
roxlu / test_vorbis.c
Last active August 29, 2015 14:00
Decoding vorbis flow (w/o cleanup yet).
/*
test_vorbis
------------
See online version: https://gist.github.com/roxlu/af1ffc1290b9dc37b5b9
Example code which decodes a .ogg file that contains vorbis and/or
some other stream, e.g. theora. We ignore all non-vorbis streams and
simply flush the packets.
@roxlu
roxlu / test_fex_load_image.cpp
Created August 22, 2014 13:22
Examples on how to load + reuse memory using rx_load_png and rx_load_jpg
/*
test_fex_load_image
-------------------
Plain test which loads + reloads a couple of images and reallocating the
previously allocated buffer when needed. Just a tiny test to speed up
the image loading process.
*/
@roxlu
roxlu / fun.cpp
Last active August 29, 2015 14:19 — forked from kizzx2/fun.cpp
THIS DOES NOT WORK WITH 5.2
// fun.cpp
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <iostream>
@roxlu
roxlu / ptf.cpp
Created December 27, 2011 22:05
Parallel Transport Frames - TEST
//--------------------------------------------------------------
void testApp::setup(){
ofSetFrameRate(60);
ofSetVerticalSync(true);
ofBackground(33);
donnie.create(125);
donnie.si.drawUsingQuads();
//renderer.addSceneItem(donnie.si);
@roxlu
roxlu / testApp.h
Created February 7, 2012 22:47
Supersimp water simulation
#pragma once
#include "ofMain.h"
#include "Roxlu.h"
struct point {
int i;
int j;
};
class testApp : public ofBaseApp{
@roxlu
roxlu / badwords.txt
Created February 8, 2012 13:39
Bad words
ahole
anus
ash0le
ash0les
asholes
ass
Ass Monkey
Assface
assh0le
assh0lez
@roxlu
roxlu / save_binary.cpp
Created February 9, 2012 22:34
Saving data into a binary file (no endianness check)
#include "TwitterSearchTermQueue.h"
namespace roxlu {
TwitterSearchTermQueue::TwitterSearchTermQueue()
:filepath()
{
}
TwitterSearchTermQueue::~TwitterSearchTermQueue() {
@roxlu
roxlu / fix_header_includes.py
Created February 10, 2012 21:07
Fixing includes for openni framework
#!/usr/bin/env python
import sys
import os
import re
# Create map of localfiles
local_files = []
for dirname, dirnames, filenames in os.walk('.'):
@roxlu
roxlu / testapp.cpp
Created March 16, 2012 21:56
Curl FTP upload
//--------------------------------------------------------------
void testApp::setup(){
ftp.setup("ftp.example.com", "username", "password", "HTML/"); // HTML/ <-- must end with slash.
}
//--------------------------------------------------------------
void testApp::update(){
ofSetWindowTitle(ofToString(ofGetFrameRate()));
ftp.update();
}