Skip to content

Instantly share code, notes, and snippets.

@rhybroy
rhybroy / fetchsub.sh
Created October 28, 2012 06:43 — forked from ravageralpha/fetchsub.sh
shell script get subtitle from shooter.cn
#!/bin/sh
# Author: RA <[email protected]>
USAGE(){
echo "Usage:fetchsub [eng] file"
}
[ $# -eq 0 -o "$1" = '--help' ] && USAGE && exit 0
ERROR(){
@rhybroy
rhybroy / resize.py
Created April 27, 2012 12:13
resize image by origin percent
import Image
basewidth = 300
img = Image.open(‘fullsized_image.jpg’)
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
img.save(‘resized_image.jpg’)
@rhybroy
rhybroy / tornado_temp_file_put.py
Created April 17, 2012 09:52 — forked from joshmarshall/tornado_temp_file_put.py
Temporary File PUT Transfer Handler for Tornado
import tornado.ioloop
import tornado.web
import tornado.httpserver
import tornado.httputil
import tempfile
class MainHandler(tornado.web.RequestHandler):
def put(self):
filename = self.request.body.name
# do stuff with the image
@rhybroy
rhybroy / ses.py
Created February 4, 2012 14:45 — forked from fanzeyi/ses.py
session for tornado
import os
import uuid
import marshal
import binascii
import tornado.web
def Session(func):
def warpper(self, *args, **kwargs):