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/python -tt | |
#Didn't you hear? The bird is the word! | |
#@version: 0.1 | |
import sys | |
def main(filename): | |
f = open(filename, "r") | |
f2 = open("log.txt", "w") | |
count = 0 | |
for line in f: |
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
#import | |
pathname = os.path.dirname(sys.argv[0]) + "/" | |
pathname = pathname + "/modules/" | |
__modules__ = [ os.path.basename(f)[:-3] for f in glob.glob(os.path.dirname(pathname)+"/*.py")] | |
for module in __modules__: | |
__import__(module) | |
#calling checkMe() |
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
import web | |
import json | |
from mimerender import mimerender | |
#Render statements | |
render_xml = lambda message: '<message>%s</message>' % message | |
render_json = lambda **args: json.dumps(args) | |
render_html = lambda message: '<html><body>%s</body></html>' % message | |
render_txt = lambda message: message |
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
{ | |
"name": "test", | |
"ip": "172.16.160.101", | |
"port": "8080", | |
"protocol": "rest", | |
"version": "0.2" | |
"rules": { | |
"1": [ | |
"string", | |
"chatname" |
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
{ | |
"number": "3", | |
"body": "i feel pretty", | |
"author": "voxeobob", | |
"chat": "Voxeo Engineering", | |
"time": "1309211072" | |
} |
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/python -tt | |
''' | |
Didn't you hear? The bird is the word! | |
@author: Philip Deuchler | |
@version: 0.2 Beta | |
''' | |
import urllib2 | |
import json | |
import web |
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
import shelve | |
import os | |
import sys | |
#Global vars | |
SHELF = os.getcwd() + '/' +'store' #variable for db name | |
LOC = os.getcwd() + '/files/' #variable for corpus location (os.getcwd() gets the current directory) | |
write = sys.stdout.write #For progress bar | |
db = {} |
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
def read_only_processor(request): | |
if read_only_flag(): | |
if request.method in ['GET', 'HEAD']: | |
return { | |
'read_only': True, | |
'error_message': 'Sorry, this site is read only right now!" | |
} | |
else: | |
#return a "Read only" response | |
else: |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
"reflect" | |
) | |
type mapFunc func(interface{}) (interface{}) |
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
def adaptive_resize(img, size=None): #img is a PIL/Pillow Image object, size is a tuple of desired dimensions | |
if size is not None: # resize image | |
if size[0] != size[1]: | |
raise Exception("Provided target dimensions must be equal") | |
smallest_side = min(img.size[0], img.size[1]) | |
if size[0] < smallest_side: # make sure we actually need to resize | |
resize_ratio = float(size[0]) / float(smallest_side) | |
resize_x = int(math.floor(img.size[0] * resize_ratio)) | |
resize_y = int(math.floor(img.size[1] * resize_ratio)) | |
img = img.resize((resize_x, resize_y)) |
OlderNewer