Skip to content

Instantly share code, notes, and snippets.

View atduskgreg's full-sized avatar

Greg Borenstein atduskgreg

View GitHub Profile
@atduskgreg
atduskgreg / gist:1319757
Created October 27, 2011 14:52
open modal file dialog in cocoa
int i; // Loop counter.
// Create the File Open Dialog class.
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
// Enable the selection of files in the dialog.
[openDlg setCanChooseFiles:YES];
// Enable the selection of directories in the dialog.
[openDlg setCanChooseDirectories:YES];

An Example of Play

To further clarify what really goes on during an AD&D game, read the following example. This is typical of the sort of action that occurs during a playing session. Shortly before this example begins, three player characters fought a skirmish with a wererat (a creature similar to a werewolf but which becomes an enormous rat instead of a wolf). The wererat was wounded and fled down a tunnel. The characters are in pursuit. The group includes two fighters and a cleric.

Fighter 1 is the group's leader.

@atduskgreg
atduskgreg / gist:2334929
Created April 8, 2012 05:19
A Typology of CV Markers
@atduskgreg
atduskgreg / live_cam_test.pde
Created April 16, 2013 16:42
Real time face detection in OpenCVPro
import gab.opencvpro.*;
import processing.video.*;
import java.awt.*;
Capture video;
OpenCVPro opencv;
void setup() {
size(640, 480, P2D);
video = new Capture(this, 640/2, 480/2);
@atduskgreg
atduskgreg / BackgroundSubtraction.pde
Last active April 26, 2021 23:09
Background Subtraction in OpenCV in Processing
import processing.video.*;
import gab.opencvpro.*;
import java.awt.Rectangle;
Movie video;
OpenCV opencv;
void setup() {
size(720, 480, P2D);
video = new Movie(this, "street.mov");
@atduskgreg
atduskgreg / hand_and_angle.pde
Created November 14, 2011 15:40
hand tracking with center point and angle kinect
import SimpleOpenNI.*;
SimpleOpenNI kinect;
void setup() {
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
// turn on user tracking
kinect.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
kinect.setMirror(true);
@atduskgreg
atduskgreg / get_window_list.mm
Last active January 2, 2021 22:28
A utility for printing out the name and windowId for every current window. Use in conjunction with 'screencapture -l' to automate screenshots.
// GetWindowList
// A utility for printing out the name and windowId for every current window.
// Use in conjunction with 'screencapture -l' to automate screenshots.
// compile with gcc thusly:
// gcc -framework carbon -framework foundation -framework cocoa -x objective-c -std=c99 GetWindowList.c -o GetWindowList
#include <Carbon/Carbon.h>
#import <objc/Object.h>
#import <Foundation/Foundation.h>
@atduskgreg
atduskgreg / rotation_around_a_point.pde
Created December 24, 2011 05:22
Controlling the center of rotation in Processing
// Rotation Around a Point
// ***********************
// To acheive rotation around a given point
// - translate to that point
// - rotate
// - then translate back
// (note: in Processing this last step is implicit
// since draw() resets all transformations
// each time it runs.)
@atduskgreg
atduskgreg / gist:1165900
Created August 23, 2011 17:17
simple_openni_scenemap.pde
import processing.opengl.*;
import SimpleOpenNI.*;
SimpleOpenNI kinect;
int[] sceneMap;
void setup() {
size(640, 480, OPENGL);
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
using System;
using System.IO//.Ports;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using UnityEngine;
/// <summary>
/// UdpPacket provides packetIO over UDP