Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / followers.py
Created June 28, 2012 15:47
Loads a list of followers from the Twitter REST API and steps through them, saving basic information about their follower and friend counts.
import simplejson as json
import urllib
followers = json.load(open("followers.json"))["ids"]
offset = 100
alldata = []
csv = "name\tfollowers\tfriends\tstatuses\tfollowing\n"
for i in range(1+len(followers) / offset):
@kylemcdonald
kylemcdonald / Averager.pde
Created June 30, 2012 16:30
Processing sketch that averages together all the files in data/ using floating point precision.
int[][] sum;
int n = 0;
PImage img;
int w, h;
void setup() {
String path = sketchPath;
File dir = new File(sketchPath + "/data");
String[] names = dir.list();
@kylemcdonald
kylemcdonald / gist:5690723
Created June 1, 2013 15:18
Trying to determine which side of a contour a vertex lies on.
ofVec2f closestPointOnLine(const ofVec2f& p1, const ofVec2f& p2, const ofVec2f& p3) {
if(p1 == p2) {
return p1;
}
float u = (p3.x - p1.x) * (p2.x - p1.x);
u += (p3.y - p1.y) * (p2.y - p1.y);
float len = (p2 - p1).length();
u /= (len * len);
if(u > 1) {
u = 1;
@kylemcdonald
kylemcdonald / glfw-3.0-10.6.8.patch
Created June 15, 2013 18:01
patch for glfw 3.0 on OSX 10.6.8
diff --git cocoa_window.m cocoa_window.m
index eea8633..fc573e0 100644
--- cocoa_window.m
+++ cocoa_window.m
@@ -32,7 +32,6 @@
// Needed for _NSGetProgname
#include <crt_externs.h>
-
// Enter fullscreen mode

Marina Abramovic is starting an interdisciplinary performance and education center.

She needs $600,000 to complete this project, so she's raising the money with a Kickstarter.

In the midst of the Kickstarter campaign there is an interesting reward:

THE EXERCISES: MUTUAL GAZE WITH MARINA ABRAMOVIC. Marina will perform the Abramovic Method eye gazing exercise with you via webcam. You may document this experience in any way you’d like and opt to include it in MAI digital archives. PLUS Neuroscience Exclusives, OMA / MAI Digital Design Package, Abramovic Method Exclusives, access to ALL $25 live stream exercises / live events, MAI 101 Lecture and Digital Booklet, MAI Founder (WALL FOUNDER), and Digital MAI rewards.

In order to help Marina meet her goal, and to explore all the possibilities of this exercise, I would like to arrange a "Mutual Gaze" session around one or more of the following constructed situations:

@kylemcdonald
kylemcdonald / InboxUnread.php
Created August 12, 2013 12:57
Inbox Unread reports inbox statistics hourly in the form of a Twitter avatar.
<!--
Inbox Unread reports inbox statistics hourly in the form of a Twitter avatar.
To run Inbox Unread first copy this php script to your server. Put your background
avatar adjacent to this file as "input.jpeg". Mine is 548x548 and all the positions
are setup for that size. Next go to http://script.google.com/ and sign in. Click
"Create a script for GMail" and replace the template with this code:
function processInbox() {
var unreadCount = GmailApp.getInboxUnreadCount();
@kylemcdonald
kylemcdonald / AutoPushPop.cpp
Last active December 23, 2015 02:09
Experiments with automatically pushing/popping styles and matrices using scope.
#include "ofAppGlutWindow.h"
#include "ofMain.h"
#define stroke(r, g, b) StrokeClass StrokeObject##__LINE__(r, g, b)
class StrokeClass {
public:
StrokeClass(float r, float g, float b) {
ofPushStyle();
ofNoFill();
import processing.video.*;
import java.awt.*;
Capture video;
void setup() {
size(640, 480);
video = new Capture(this, 640, 480);
video.start();
}
import processing.video.*;
import gab.opencv.*;
OpenCV opencv;
Capture video;
PVector ploc = new PVector();
PVector loc = new PVector();
void setup() {
size(640, 480);
import gab.opencv.*;
import processing.video.*;
Capture video;
OpenCV bg;
OpenCV opencv;
PImage curBg;
PImage colorDiff;