Skip to content

Instantly share code, notes, and snippets.

View mattwilliamson's full-sized avatar

Matt Williamson mattwilliamson

View GitHub Profile
#!/usr/bin/env python
# Derived from http://sundararajana.blogspot.com/2007/05/motion-detection-using-opencv.html
import cv
class Target:
def __init__(self):
self.capture = cv.CaptureFromCAM(0)
cv.NamedWindow("Target", 1)
#!/usr/bin/python2.6
import sys, os
# Add a custom Python path.
sys.path.insert(0, "..")
# Switch to the directory of your project. (Optional.)
os.chdir("/var/www/myproject")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
matt@valkyrie:/var/www/myproject$ sh myproject.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
settings_local loaded
Status: 404 NOT FOUND
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
$HTTP["host"] =~ "myproject\.myhost\.com" {
fastcgi.server = (
".fcgi" => (
"localhost" => (
"bin-path" => "/var/www/myproject/myproject.fcgi",
"socket" => "/tmp/myproject.sock",
"check-local" => "disable",
"min-procs" => 2,
"max-procs" => 4,
)
matt@valkyrie:/etc/lighttpd/conf-available$ sudo ln -s /etc/lighttpd/conf-available/15-pictag.conf /etc/lighttpd/conf-enabled/15-myproject.conf
matt@valkyrie:/etc/lighttpd/conf-available$ sudo /etc/init.d/lighttpd restart
FORCE_SCRIPT_NAME = ""
FORCE_SCRIPT_NAME = ""
#!/usr/bin/env python
# encoding: utf-8
class SomeClass(object):
attribute = 0
def main():
c = SomeClass()
c.attribute = 5
print c.attribute
#!/usr/bin/env python
import pygame
from pygame.locals import *
import serial, time, random, os, datetime
ser = None
last_transmit = None
pygame.init()
int ledPin = 13;
boolean ledOn = false;
void setup() {
pinMode(ledPin, OUTPUT); // Set servo pin as an output pin
Serial.begin(9600);
//Serial.println("Arduino serial");
}
void loop() {