Skip to content

Instantly share code, notes, and snippets.

View brysonian's full-sized avatar

Chandler McWilliams brysonian

View GitHub Profile
@brysonian
brysonian / rect.pde
Created March 31, 2009 20:08
[Processing] rect function that takes a java Rectangle
void rect(Rectangle r) {
rect(r.x, r.y, r.width, r.height);
}
@brysonian
brysonian / poly.pde
Created March 31, 2009 20:15
[Processing] poly function that takes a java Polygon
void poly(Polygon p) {
beginShape();
for (int i=0; i<p.npoints; i++) {
vertex(p.xpoints[i], p.ypoints[i]);
}
endShape(CLOSE);
}
@brysonian
brysonian / suica_penguin_head.pde
Created April 2, 2009 16:00
[Processing] suica penguin head
fill(0);
ellipse(250, 250, 200, 175);
fill(255);
ellipse(210, 240, 30, 30);
ellipse(290, 240, 30, 30);
fill(0);
ellipse(210, 240, 15, 15);
ellipse(290, 240, 15, 15);
fill(255);
@brysonian
brysonian / dma_transcode.rb
Created April 5, 2009 17:21
Script to transcode DMA .rm videos to mp4 and mp3
#!/usr/bin/env ruby
require 'yaml'
require 'fileutils'
require 'mysql'
class Transcoder
#Path to tools
@@MENCODER = "/usr/local/bin/mencoder"
@@MPLAYER = "/usr/local/bin/mplayer"
@@FFMPEG = "/opt/local/bin/ffmpeg"
@brysonian
brysonian / tab.sh
Created April 7, 2009 00:14
Random terminal tab
#!/bin/bash
# create a new tab in terminal using a random style setting
osascript -e 'tell application "Terminal"'\
-e 'activate'\
-e 'set s to some item of (the name of every settings set as list) as text'\
-e 'end tell'\
-e 'tell application "System Events"'\
-e 'tell process "Terminal"'\
@brysonian
brysonian / transcode_for_iphone.sh
Created April 15, 2009 21:08
handy shell script for transcoding to iphone formatted mp4. Requires mencoder.
#!/bin/bash
mencoder $1 -o $1.mp4 \
-vf dsize=480:320:2,scale=-8:-8,harddup \
-oac faac -faacopts mpeg=4:object=2:raw:br=128 -channels 1 -srate 44100 \
-of lavf -lavfopts format=mp4 \
-ovc x264 -x264encopts bitrate=256:nocabac:level_idc=30:bframes=0:global_header:threads=auto:partitions=all \
-ofps 15
@brysonian
brysonian / cli_args.pde
Created April 19, 2009 16:56
[Processing] Example of passing arguments via command line.
static String[] args;
int r = 0;
int g = 0;
int b = 0;
void setup() {
if (args != null && args.length == 3) {
// all args are strings so we need to convert to ints
r = parseInt(args[0]);
@brysonian
brysonian / first_names.php
Created April 21, 2009 22:21
list of first names formatted as a PHP array
<?php
$names = array(
'Allison',
'Arthur',
'Ana',
'Alex',
'Arlene',
'Alberto',
'Barry',
@brysonian
brysonian / OSCSpaceNavigator.pde
Created April 22, 2009 22:50
[Processing] Simple example of connecting processing to a SpaceNavigator via OSCulator
/*
Simple example showing how to use the
SpaceNavigator <http://www.3dconnexion.com/3dmouse/spacenavigator.php>
with processing via OSC and OSCulator <http://www.osculator.net/>.
*/
import processing.opengl.*;
import oscP5.*;
@brysonian
brysonian / textmate_to_things.rb
Created May 13, 2009 22:35
TextMate command to create Things todos from selection
#!/usr/bin/ruby
# creates a todo in Thing's Inbox for each line in the selection
# set input as selected text or nothing
ENV['TM_SELECTED_TEXT'].split("\n").reverse_each do |line|
system("osascript \
-e 'tell application \"Things\"' \
-e ' set newToDo to make new to do ¬' \