Skip to content

Instantly share code, notes, and snippets.

@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 / 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>
@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: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: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:6e41b6b0a3981309522f
Created September 22, 2014 01:14
List all connected devices in terminal
ls /dev/tty*
@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 "[email protected]" --mail-rcpt "[email protected]" --ssl -u [email protected]: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:0d317dd13b9ac36cb51c
Last active August 29, 2015 14:06
Terminal shortcuts
VIEW RUNNING APPS
top
SSH INTO MACHINE
ssh [email protected]
SSH REMOTE TO LOCAL COPY
scp [email protected]:/Users/trentbrooks/Desktop/150327_Background.png bg.png
SSH REMOTE TO LOCAL COPY (FOLDER + RECURSIVE)