Skip to content

Instantly share code, notes, and snippets.

View mattwilliamson's full-sized avatar

Matt Williamson mattwilliamson

View GitHub Profile
<?php
$device_id = $_POST["udid"];
if(array_key_exists("photo", $_FILES)) {
$file = $_FILES["photo"];
if($file["error"] == 0) {
$size = $file["size"]; // Bytes
$type = $file["type"]; // image/jpeg
move_uploaded_file($file["tmp_name"], "/path/to/new/location");
} else {
// There was an error
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() {
#!/usr/bin/env python
import pygame
from pygame.locals import *
import serial, time, random, os, datetime
ser = None
last_transmit = None
pygame.init()
#!/usr/bin/env python
# encoding: utf-8
class SomeClass(object):
attribute = 0
def main():
c = SomeClass()
c.attribute = 5
print c.attribute
FORCE_SCRIPT_NAME = ""
FORCE_SCRIPT_NAME = ""
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
$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:/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">
#!/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"