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 os | |
import uuid | |
import marshal | |
import binascii | |
import tornado.web | |
def Session(func): | |
def warpper(self, *args, **kwargs): |
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 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 |
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 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’) |
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
#!/bin/sh | |
# Author: RA <[email protected]> | |
USAGE(){ | |
echo "Usage:fetchsub [eng] file" | |
} | |
[ $# -eq 0 -o "$1" = '--help' ] && USAGE && exit 0 | |
ERROR(){ |
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
#!/user/bin/env python | |
# -*- coding: utf-8 -*- | |
class arithmetic(): | |
def __init__(self): | |
pass | |
''' 【编辑距离算法】 【levenshtein distance】 【字符串相似度算法】 ''' | |
def levenshtein(self,first,second): | |
if len(first) > len(second): |
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
#!/bin/bash | |
if [ $(id -u) != "0" ]; then | |
printf "Error: You must be root to run this tool!\n" | |
exit 1 | |
fi | |
clear | |
printf " | |
#################################################### | |
# # |
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
# | |
# | |
216.73.93.70/31 | |
216.73.93.72/31 | |
216.239.32.0/19 | |
64.233.160.0/19 | |
66.249.80.0/20 | |
72.14.192.0/18 | |
209.85.128.0/17 |
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
require 'formula' | |
class TmuxIterm2 < Formula | |
url 'https://iterm2.googlecode.com/files/tmux-for-iTerm2-20130319.tar.gz' | |
sha1 'f14a0bad6991b9e3380d5c3a6057e09f62597d1f' | |
head 'git://tmux.git.sourceforge.net/gitroot/tmux/tmux' | |
depends_on 'pkg-config' => :build | |
depends_on 'libevent' |
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
alias fp='ps aux|grep' | |
alias vi='mvim' | |
alias df="df -h" | |
alias mv="mv -i" | |
alias slink="link -s" | |
alias l="ls -lh" | |
alias la="ls -lhAF" | |
alias ll="ls -lhF" | |
alias lt="ls -lhtrF" | |
alias l.="ls -lhtrdF .*" |
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
set msg to "" | |
tell application "System Events" | |
tell current location of network preferences | |
set VPNservice to service "VPN (PPTP)" | |
if exists VPNservice then | |
set isConnected to connected of current configuration of VPNservice | |
if isConnected then | |
disconnect VPNservice | |
set msg to "Disconnected" | |
else |
OlderNewer