Skip to content

Instantly share code, notes, and snippets.

View enjalot's full-sized avatar

Ian Johnson enjalot

View GitHub Profile
MAIN="Main1"
all:
javac -cp ../ -d ../classes $(MAIN).java
go:
java -cp ../classes $(MAIN)
clean:
find . -name '../classes/$(MAIN).class' -exec rm -f {} \;
QUESTIONS = q1 q2
COMMAND=all
.PHONY: questions $(QUESTIONS) go clean first
questions: $(QUESTIONS)
$(QUESTIONS):
$(MAKE) -C $@ $(COMMAND) $(VARS)
import WiiMote
import objc
from threading import Thread
from threading import Event
from time import sleep
class Main(Thread):
discovery = objc.ivar('discovery')
remote = objc.ivar('wii')
@enjalot
enjalot / timing.py
Created March 7, 2011 11:31
A timing decorator class using a coroutine for the fun of it
import time
class Timing(object):
def __init__(self):
self.timings = {}
self.col = self.__collector()
self.col.next() #coroutine syntax
def __collector(self):
while True:
@enjalot
enjalot / part2.c
Created March 22, 2011 20:41
OpenCL Kernel for a simple particle system
__kernel void part2(__global float4* pos,
__global float4* color,
__global float4* vel,
__global float4* pos_gen,
__global float4* vel_gen,
float dt)
{
//get our index in the array
unsigned int i = get_global_id(0);
//copy position and velocity for this iteration to a local variable
@enjalot
enjalot / gl_interop92.py
Created March 24, 2011 15:12
PyOpenCL .92 GL Interop
from OpenGL import GLX
def clinit(self):
plats = cl.get_platforms()
ctx_props = cl.context_properties
props = [(ctx_props.PLATFORM, plats[0]),
(ctx_props.GL_CONTEXT_KHR, platform.GetCurrentContext())]
import sys
@enjalot
enjalot / encodingTest.cpp
Created April 22, 2011 18:42 — forked from mathnathan/encodingTest.cpp
Video Networking
# include "highgui.h"
# include "cv.h"
# include <stdio.h>
# include <vector>
# include <string>
///blah
using namespace cv;
@enjalot
enjalot / index.html
Created September 8, 2011 15:15
Simple Pie Chart example with D3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@enjalot
enjalot / index.html
Created September 15, 2011 04:47
[d3cast] Simple Bar Chart example with d3.js
<!-- Annotated javascript available at http://enja.org/code/tuts/d3/bar -->
<!-- Code walkthrough screencast available at -->
<html>
<head>
<title>Enjalot's Bar</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
.bar rect
@enjalot
enjalot / bar.html
Created September 15, 2011 04:55
testing
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">