Skip to content

Instantly share code, notes, and snippets.

View GLSL-Noise.md

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@jamiebullock
jamiebullock / LiveAudioProcessing.swift
Created Jun 19, 2014
Live coding audio with Swift Playgrounds
View LiveAudioProcessing.swift
import Cocoa
import AVFoundation
// Setup engine and node instances
var engine = AVAudioEngine()
var delay = AVAudioUnitDelay()
var reverb = AVAudioUnitReverb()
var mixer = engine.mainMixerNode
var input = engine.inputNode
@kylemcdonald
kylemcdonald / main.cpp
Created Apr 24, 2014
Example of using libpcap with openFrameworks in monitor mode in OS X (probably similar on Linux). By default we are only watching for probe request frames.
View main.cpp
// make sure to link against /usr/lib/libpcap.dylib
#include "ofMain.h"
#include <pcap/pcap.h>
class ofApp : public ofBaseApp {
public:
pcap_t *pcap;
struct pcap_pkthdr header;
const unsigned char* packet = NULL;
list<string> packetHex;
@yat1ma30
yat1ma30 / main.js
Last active Dec 23, 2015
ラングトンのアリ
View main.js
var SCREEN_SIZE = 500; // キャンバスのサイズ
var SIDE_CELLS = 200; // 一辺のセルの数
var CELL_SIZE = SCREEN_SIZE / SIDE_CELLS; // 1マスの幅
var FPS = 200; // フレームレート
var canvas; // キャンバス
var context; // コンテキスト
var dirs = [ // アリの方向用配列
{'row': -1, 'col': 0},
{'row': 0, 'col': 1},
{'row': 1, 'col': 0},
View testApp.cpp
#include "testApp.h"
void addFace(ofMesh& mesh, ofVec3f a, ofVec3f b, ofVec3f c) {
mesh.addVertex(a);
mesh.addVertex(b);
mesh.addVertex(c);
ofVec3f p0 = (a-b).getNormalized();
ofVec3f p1 = (b-c).getNormalized();