Skip to content

Instantly share code, notes, and snippets.

View rc1's full-sized avatar

Ross Cairns rc1

View GitHub Profile
@rc1
rc1 / gist:69b2c49d0efaebeafd08
Last active November 23, 2015 10:49
Building node.js for Raspberry Pi 2 (with Armv7 and Neon support)
export CC='gcc -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon'
export CXX='g++ -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon'
./configure --without-snapshot
make -j4
sudo make install
@rc1
rc1 / generatePieMesh.h
Last active August 29, 2015 14:12
OpenFrameworks Pie Chart Example for Jon
#pragma once
#include "ofMain.h"
ofMesh generatePieMesh( float value, float radius = 10.f, float segments = 32 ) {
// Create our mesh.
ofMesh mesh;
mesh.setMode( OF_PRIMITIVE_TRIANGLE_FAN );
// Add the center point
@rc1
rc1 / gist:44525d22483bbffc176c
Created September 15, 2014 14:16
Stefan Demo
var sys = require('sys')
var exec = require('child_process').exec;
var child;
var vpnClientAddrs;
// We can use function pull ups which helps keep things clean.
// The pull up means we can use the function here even though it is below
getIpAddresses( doSomethingWithResults );
@rc1
rc1 / Gruntfile.js
Created September 8, 2014 18:03
Grunt
module.exports = function( grunt ) {
// # Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
// ## Documentation
docco: {
'all': {
src: [ 'app.musictomoveto.js', 'public/js/main.js', 'libs/*.js', 'Gruntfile.js' ],
options: {
@rc1
rc1 / gist:99cc54929808c987f603
Created May 13, 2014 11:55
Dave's challenge
(ns sorter.core
(:require [clojure.java.io :refer :all]
[clojure.string :as string]
[clojure.pprint :as pprint]))
(def faces-by-img
"This is a vector containing each image with a nested vector of faces found in the image"
(reduce
(fn [acc [[img] data]]
(merge acc { :img img :faces (reduce
// From: http://www.cprogramming.com/c++11/c++11-lambda-closures.html
#include <iostream>
using namespace std;
int main()
{
auto func = [] () { cout << "Hello world"; };
func(); // now call the function
@rc1
rc1 / gist:9758728
Created March 25, 2014 10:23
sudo gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-h264, width=1280,height=720,framerate=30/1' ! h264parse ! rtph264pay pt=96 config-interval=1 ! gdppay ! tcpserversink host=0.0.0.0 port=1234
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
(gst-launch-1.0:21526): GStreamer-WARNING **: gstpad.c:4506:store_sticky_event:<gdpdepay0:src> Sticky event misordering, got 'segment' before 'caps'
/GstPipeline:pipeline0/GstGDPDepay:gdpdepay0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)"Z0JAKLtAKALb+AokAAADAAQAAAMA8YEAALcbAAtx73vheEQjUA\=\=\,aM44gA\=\=", payload=(int)96, ssrc=(uint)3559254462, timestamp-offset=(uint)3329980361, seqnum-offset=(uint)46515
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01424028ffe1002567424028bb402802dbf80a24000003000400000300f1810000b71b000b71ef7be17844235001000468ce3880
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01424028ffe1002567424028bb402802dbf80a240000030004000
@rc1
rc1 / gist:9435952
Created March 8, 2014 17:56
Homebrew GStreamer formula with vex / vp8enc
require 'formula'
class GstPluginsGood < Formula
homepage 'http://gstreamer.freedesktop.org/'
stable do
url 'http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.2.3.tar.xz'
mirror 'http://ftp.osuosl.org/pub/blfs/svn/g/gst-plugins-good-1.2.3.tar.xz'
sha256 'bfb33536a515bdcc34482f64b8d9cc3e47c753878b254923b419bc2f7485e470'
@rc1
rc1 / main.cpp
Last active December 26, 2015 13:29
Playing with cpp11 (lambdas and ofxUI) in OpenFrameworks. Quick 24 channel DMX controller in one file.
#include "ofMain.h"
#include "ofxDMX.h"
#include "ofxUI.h"
#define NUMBER_OF_DMX_CHANNELS 24
//========================================================================
#pragma mark - UI Utils
inline void preConfigureCanvas(ofxUICanvas *ui) {
@rc1
rc1 / ContentList.cpp
Last active December 22, 2015 04:19
Example/draft API for Your Tour c++
// # ContentList
// Can be created
ContentList allcontent;
// Can load it from the cms, and write it to disk
allcontent.fetch();
// Load it from disk and parse it
allcontent.load();