Skip to content

Instantly share code, notes, and snippets.

@qingfeng
qingfeng / django_jinja.py
Created July 29, 2011 13:48 — forked from rozza/django_jinja.py
Django 1.2 and Jinja2 loader
"""
Using Jinja2 with Django 1.2
Based on: http://djangosnippets.org/snippets/2063/
To use:
* Add this template loader to settings: `TEMPLATE_LOADERS`
* Add template dirs to settings: `JINJA2_TEMPLATE_DIRS`
If in template debug mode - we fire the template rendered signal, which allows
debugging the context with the debug toolbar. Viewing source currently doesnt
import hypermedia.video.*;
OpenCV opencv;
void setup() {
size( 640, 480 );
// open video stream
opencv = new OpenCV( this );
opencv.capture( 640, 480 );
@qingfeng
qingfeng / random_rect.processing
Created March 20, 2011 16:14
rect random by Processing
void setup(){
size(800,600);
background(255);
noStroke();
colorMode(RGB);
frameRate(15);
}
void draw() {
color c = color(random(255),random(255),random(255));
@qingfeng
qingfeng / gist:874415
Created March 17, 2011 14:31
Processing Bubble Game
import hypermedia.video.*; // Imports the OpenCV library
OpenCV opencv; // Creates a new OpenCV object
PImage movementImg; // Creates a new PImage to hold the movement image
int poppedBubbles; // Creates a variable to hold the total number of popped bubbles
ArrayList bubbles; // Creates an ArrayList to hold the Bubble objects
PImage bubblePNG; // Creates a PImage that will hold the image of the bubble
PFont font; // Creates a new font object
void setup()
@qingfeng
qingfeng / image4.pde
Created February 17, 2011 17:40
Processing+OpenCV
import hypermedia.video.*;
OpenCV opencv;
void setup() {
size(480, 320);
opencv = new OpenCV(this);
opencv.capture(width/2, height/2);
}
void draw() {
@qingfeng
qingfeng / detect_faces.pde
Created February 17, 2011 17:40
Processing+OpenCV
import hypermedia.video.*;
import java.awt.Rectangle;
OpenCV opencv;
void setup() {
size( 320, 240 );
opencv = new OpenCV(this);
@qingfeng
qingfeng / bg_color.sh
Created January 27, 2011 01:30
Production is Red
#!/bin/sh
export R=$1
export G=$2
export B=$3
/usr/bin/osascript <<EOF
tell application "Terminal"
tell window 0
set the background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))}
// ==UserScript==
// @name Love
// @namespace http://091018.com
// @include http://www.douban.com/people/*
// @description Love
// @version 20101015
// ==/UserScript==
/*globals XPathResult, GM_getValue, GM_setValue, localStorage, unescape,
frameElement */
@qingfeng
qingfeng / demo.user.js
Created October 15, 2010 12:09
Chrome user Script Demo
// ==UserScript==
// @name Demo
// @namespace http://youdomain.com
// @include http://www.douban.com/*
// @description Demo
// @version 20101015
// ==/UserScript==
/*globals XPathResult, GM_getValue, GM_setValue, localStorage, unescape,
frameElement */