Skip to content

Instantly share code, notes, and snippets.

@trentbrooks
trentbrooks / TemplateInfo.plist
Created April 29, 2014 07:52
Edit the xcode c++ template- duplicate C++ Class.xctemplate in Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/ C and C++/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AllowedTypes</key>
<array>
<string>public.c-plus-plus-source</string>
</array>
<key>DefaultCompletionName</key>
<string>File</string>
dest = []
locs = []
def process(line):
global dest
inp_split = line.split(':')
dep = inp_split[0]
conn = inp_split[1]
dist = int(inp_split[2])
@trentbrooks
trentbrooks / gist:d6c63496b28b2ce1b11b
Created November 13, 2015 03:30
OF/Poco directory watcher minimal example
// ofApp.h
#include "Poco/DirectoryWatcher.h"
#include "Poco/Delegate.h"
Poco::DirectoryWatcher* watcher;
void onFileAdded(const Poco::DirectoryWatcher::DirectoryEvent& addEvent);
void onFileChanged(const Poco::DirectoryWatcher::DirectoryEvent& changeEvent);
// ofApp.cpp
watcher = new Poco::DirectoryWatcher(ofToDataPath("img"));
@trentbrooks
trentbrooks / gist:ea0ba99f4d0816483866
Last active December 9, 2016 10:54
Raspberry PI install system image from terminal
diskutil list
diskutil unmountDisk /dev/disk3
// snappy ubuntu core
sudo dd bs=1m if=~/Downloads/pi-snappy.img of=/dev/disk3
// raspbian
sudo dd bs=1m if=~/Downloads/2015-01-31-raspbian.img of=/dev/disk3
// retropie (assumes .img is in Downloads folder)
@trentbrooks
trentbrooks / gist:f6fa8969954bc572523c
Last active May 13, 2016 01:33
Embedded computing list
Raspberry PI
Cubieboard2
Intel NUC
ODROID-U3
Beaglebone Black
CuBox
UDOO
Jetson TK1
HummingBoard
Brix Pro
@trentbrooks
trentbrooks / gist:7496260
Created November 16, 2013 05:14
Point Grey modified
#include "FlyCapture2.h"
using namespace FlyCapture2;
@trentbrooks
trentbrooks / gist:7444679
Created November 13, 2013 06:33
Easy event listener adding/removing. Put below methods in the object's .h only, and make sure the testApp has the onSomething method.
template <class ListenerClass>
void addEventListener(ListenerClass * listener){
ofAddListener(onChangedEvent,listener,&ListenerClass::onSomething);
};
template <class ListenerClass>
void removeEventListener(ListenerClass * listener){
ofRemoveListener(onChangedEvent,listener,&ListenerClass::onSomething);
};
@trentbrooks
trentbrooks / gist:7206615
Created October 28, 2013 23:26
Icosahedron
ofMesh ico = createIcosahedron(120);
ofMesh testApp::createIcosahedron(float size) {
ofMesh mesh;
GLdouble vertexB[][3]= {
{0, -0.525731, 0.850651}, // vertices[0]
{0.850651, 0, 0.525731}, // vertices[1]
{0.850651, 0, -0.525731}, // vertices[2]
{-0.850651, 0, -0.525731}, // vertices[3]
@trentbrooks
trentbrooks / drawRibbonRainbow
Last active December 25, 2015 03:49
draw a rainbow ribbon (uses MeshUtils.h)
deque<ofVec3f> mousePts;
void testApp::drawRibbonRainbow() {
mousePts.push_back(ofVec3f(ofGetMouseX(), ofGetMouseY(), 0));
ofPolyline polyPoints;
for(int i = 0; i < mousePts.size(); i++) {
polyPoints.addVertex(mousePts[i]);
}
@trentbrooks
trentbrooks / .bash_profile
Created May 20, 2013 00:39
Lazy GitHub shortcut: copy file into your home directory next to '.bash_history' (if .bash_profile already exists, just copy/paste the function below). Launch terminal, cd into your local repo, then type- gitit "some commit". Note, function assumes your working with a 'develop' branch, if not change 'develop' to whatever your branch is, eg. 'mas…
function gitit {
git pull origin develop
git add -A
git commit -am "$1"
git push origin develop
}