This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
mms.py | |
Created by yanxu on 2006-11-27. | |
Copyright (c) 2006 __80s__. All rights reserved. | |
""" | |
import os, sys | |
from django.core.management import execute_manager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2010-08-05 00:27:19] LuzHandler created | |
Traceback (most recent call last): | |
File "./luz-scgi.py", line 82, in <module> | |
main(LuzHandler) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scgi/quixote_handler.py", line 163, in main | |
max_children=max_children).serve() | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scgi/scgi_server.py", line 346, in serve | |
self.serve_on_socket(self.get_listening_socket()) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scgi/scgi_server.py", line 337, in serve_on_socket | |
self.delegate_request(conn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size(1024,800) | |
colormode(RGB) | |
nofill() | |
background(0.9137, 0.9569, 0.9137) | |
for i in range(100): | |
stroke(0.9843, 0.8118, 0.5961, random(0.3)) | |
strokewidth(random(8)) | |
radius = random(500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
colors = ximport("colors") | |
except ImportError: | |
colors = ximport("__init__") | |
reload(colors) | |
bg = rect(0,0,WIDTH,HEIGHT,draw=False) | |
colors.gradientfill(bg, color(random(),random(),random()), color(random(),random(),random())) | |
colors.shadow() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoteContentRequest(): | |
# these are used for making the request | |
SC_OK = 200; #Please, use only for testing! | |
DEFAULT_CONTENT_TYPE = "application/x-www-form-urlencoded; charset=utf-8"; | |
def __init__(self,uri, headers = {}, postBody = None): | |
self.uri = uri; | |
self.headers = headers; | |
self.postBody = postBody; | |
import time; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trace import traced | |
def tracing(cls): | |
cdict = cls.__dict__ | |
for n in cdict: | |
if hasattr(cdict[n], "__call__") \ | |
and not n.startswith("__"): | |
cdict[n] = traced(cdict[n]) | |
return cls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trace import traced | |
class Tracer(type): | |
def __new__(cls, name, bases, cdict): | |
for n in cdict: | |
if callable(cdict[n]) \ | |
and not n.startswith("__"): | |
cdict[n] = traced(cdict[n]) | |
return type.__new__(cls, name, bases, cdict) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> | |
</script> | |
</head> | |
<body> | |
<canvas id="canvas" width="600" height="500"></canvas><br/> | |
<button id="output">输出HTML</button><br/> | |
<textarea id="html" rows="20" cols="50"></textarea> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class M1(models.Model): | |
title = models.CharField(max_length=100) | |
img1 = models.ImageField(upload_to="static/") | |
def __unicode__(self): | |
return self.title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "".join( re.findall(r"(\s+)(def)(\D+)",s) [0]) |