Skip to content

Instantly share code, notes, and snippets.

@trentbrooks
trentbrooks / gist:8969897
Last active August 29, 2015 13:56
for kurt
int previousStatus = 0; // 0 = nothing, 1 = hand above head
int resetStatusCounter = 0;
int resetStatusThreshold = 100;
void draw() {
// do normal kinect updates and processing here (your code)
int status = ?; // you need to work out when hand is above, etc
@trentbrooks
trentbrooks / gist:9357821
Last active August 29, 2015 13:57
stringstream extraction
string data = "hello there";
// standard stringstream extraction based on ' ' character
stringstream ss(data);
string extract1;
ss >> extract1; // hello
cout << extract1 << endl;
string extract2;
ss >> extract2; // there
cout << extract2 << endl;
@trentbrooks
trentbrooks / gist:11392776
Created April 29, 2014 07:18
Download all images from website (1-88 on gratisography.com) with curl
curl "http://www.gratisography.com/pictures/[1-88]H.jpg" -o "#1.jpg"
@trentbrooks
trentbrooks / gist:bfb6412fbbf5e28dfba6
Created June 19, 2014 00:11
ofSystem bug with fclose in openframeworks
string ofSystem(string command){
FILE * ret = NULL;
#ifdef TARGET_WIN32
ret = _popen(command.c_str(),"r");
#else
ret = popen(command.c_str(),"r");
#endif
string strret;
char c;
@trentbrooks
trentbrooks / gist:19514e0985794fd6a21d
Last active August 29, 2015 14:03
syncing OF fork with local master, then merge with develop
git fetch upstream
git checkout master
git merge upstream/master
git checkout develop
git merge upstream/master
// merge a branch into master
git checkout master
git pull origin master
@trentbrooks
trentbrooks / gist:d82911ee9a39b201d0ee
Created September 15, 2014 22:02
Hide console window in VS for OF apps - add to main.cpp
HWND handleWindow;
AllocConsole();
handleWindow = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(handleWindow, 0);
@trentbrooks
trentbrooks / gist:0d317dd13b9ac36cb51c
Last active August 29, 2015 14:06
Terminal shortcuts
VIEW RUNNING APPS
top
SSH INTO MACHINE
ssh whip@10.1.1.9
SSH REMOTE TO LOCAL COPY
scp trentbrooks@trents-mbp.lightwell.com.au:/Users/trentbrooks/Desktop/150327_Background.png bg.png
SSH REMOTE TO LOCAL COPY (FOLDER + RECURSIVE)
@trentbrooks
trentbrooks / gist:90e7423df16af7222178
Created September 22, 2014 01:17
Curl download/email/form post commands
DOWNLOAD A FILE (big O)
curl -O http://www.trentbrooks.com/index.html
DOWNLOAD A FILE TO DIRECTORY/FILENAME (little o)
curl -o GitProjects/thatpage.html http://www.trentbrooks.com/index.html
SEND FILE ATTACHMENT WITH GMAIL
curl smtps://smtp.gmail.com:465 -v --mail-from "trentbrooks@gmail.com" --mail-rcpt "trent@lightwell.com.au" --ssl -u trentbrooks@gmail.com:PASSWORD -T "test.txt" -k --anyauth
FORM POST: http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request
@trentbrooks
trentbrooks / gist:6e41b6b0a3981309522f
Created September 22, 2014 01:14
List all connected devices in terminal
ls /dev/tty*
#include "ofMain.h"
void enableMidmap(ofTexture& texture) {
texture.bind();
int textureTarget = texture.getTextureData().textureTarget;
glTexParameteri(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glGenerateMipmap(GL_TEXTURE_2D); // automatically creates midmaps for textures
texture.unbind();