Skip to content

Instantly share code, notes, and snippets.

View jkosoy's full-sized avatar

Jamie Kosoy jkosoy

View GitHub Profile
@jkosoy
jkosoy / gist:5379904
Last active June 20, 2023 14:06
Raspberry Pi setup

Raspberry Pi setup

Just wanted a quick start guide for myself so that I wouldn't have to keep rooting through Google to remember all this stuff. Hopefully it helps other people.

If you had other ideas or suggestions please leave a comment.

Useful things to own before you buy a Pi

The first time I bought a Pi I was enormously frustrated with myself because I didn't own all of this stuff. Kept having to order things off of Amazon and wait to get started... very irritating. This is all good stuff to have laying around anyway:

@jkosoy
jkosoy / index.html
Created March 22, 2013 18:56
A CodePen by Adam. Tear-able Cloth - Javascript cloth simulation.
<canvas id = "c" > </canvas>
<p>
Tear the cloth with your mouse.<br><br>
Right click and drag to cut the cloth.<br><br>
Reduce physics_accuracy if it's laggy, increase it for a better effect.
</p>
@jkosoy
jkosoy / index.html
Created March 22, 2013 18:56
A CodePen by Adam. Tear-able Cloth - Javascript cloth simulation.
<canvas id = "c" > </canvas>
<p>
Tear the cloth with your mouse.<br><br>
Right click and drag to cut the cloth.<br><br>
Reduce physics_accuracy if it's laggy, increase it for a better effect.
</p>
@jkosoy
jkosoy / testApp.cpp
Last active December 14, 2015 07:09
ofImage to ofBuffer not working... why?
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofImage foo;
foo.loadImage("walrus.jpg");
ofPixels px;
px.setFromPixels(foo.getPixels(), foo.width, foo.height, foo.getPixelsRef().getImageType());
@jkosoy
jkosoy / ExampleDispatcher.pde
Last active December 14, 2015 00:39
Processing example of event dispatching.
class ExampleDispatcher {
private Object _listener;
public void setListener(Object obj) {
_listener = obj;
}
public void dispatchBasic() {
try {
Method callback = _listener.getClass().getMethod("handleBasicEvent");
@jkosoy
jkosoy / testApp.cpp
Created February 17, 2013 16:44
Example code to reproduce the error in ofxFastFboReader (https://github.com/satoruhiga/ofxFastFboReader) I discovered. Create an app, resize the window and press "s" to save a different file in your data directory. Sometimes this will work and other times it won't.
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofSetVerticalSync(true);
ofEnableAlphaBlending();
ofSetFrameRate(30);
counter = 0;
fboReader.setAsync(false);
@jkosoy
jkosoy / gist:4708253
Created February 4, 2013 17:44
openFrameworks MD5 Encryption
// .h
#include "Poco/MD5Engine.h"
#include "Poco/DigestStream.h"
#include "Poco/StreamCopier.h"
using Poco::DigestEngine;
using Poco::MD5Engine;
using Poco::DigestOutputStream;
using Poco::StreamCopier;
@jkosoy
jkosoy / gist:4657510
Created January 28, 2013 17:43
SCSS Responsive Mixin
// breakpoints
$break-small: 400px;
$break-large: 1024px;
@mixin respond-to($media) {
@if $media == handhelds {
@media only screen and (max-width: $break-small) { @content; }
}
@else if $media == medium-screens {
@media only screen and (min-width: $break-small + 1) and (max-width: $break-large - 1) { @content; }
@jkosoy
jkosoy / gist:4359595
Created December 22, 2012 15:58
NSLog datatypes, courtesy http://snipplr.com/view/21403/
NSLog(@"%@", [NSNumber numberWithInt:i]);
/*
%@ Object
%d, %i signed int
%u unsigned int
%f float/double
%1.2f to controll number of decimals
%x, %X hexadecimal int
@jkosoy
jkosoy / .bash_profile
Last active October 13, 2015 02:38
Bash Profile Settings.
alias ls='ls -GFh'
export CLICOLOR=1
# From Andrzej Szelachowski's ~/.bash_profile:
# Note that a variable may require special treatment
#+ if it will be exported.
DARKGRAY='\[\e[1;30m\]'