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/python2.7 | |
import urllib2 | |
import httplib | |
import re | |
import sys | |
import PIL.Image | |
usernamere = re.compile('username="?(.*)"') | |
portraitre = re.compile(r"'portrait' : '?(.*)',") |
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
if [ $# -lt 2 ] ;then | |
echo 'usage:genphoto.sh column rows' | |
exit -1 | |
fi | |
column=$1 | |
rows=$2 | |
for i in `seq 1 $(($column*$rows))`;do | |
if [ "`identify $i.jpg | cut -d' ' -f2 | head -n1`" = "GIF" ];then |
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> | |
<script type="text/javascript"> | |
if(navigator.platform.indexOf("Linux")==0){ | |
window.location.href="http://localhost/linux.html"; | |
} else { | |
window.location.href="http://localhost/other.html"; | |
} | |
</script> | |
</head> |
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
# coding:utf8 | |
users_id = [600411795] | |
threads = 8 | |
import os | |
import pickle | |
import requests | |
import threading |
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 getToken(session): | |
session.get('http://www.baidu.com') | |
token = session.get('https://passport.baidu.com/v2/api/?getapi&class=login&tpl=pp&tangram=false').text | |
token_index = token.index('login_token')+len('login_token')+2 | |
token = token[token_index:-1] | |
token = token[0:token.index("'")] | |
return token | |
def getvcode(codestring): | |
url = 'https://passport.baidu.com/cgi-bin/genimage?'+codestring |
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 | |
# Simple grep | |
# usage: simple_grep.py <regex> <filename> | |
import sys | |
import re | |
if __name__ == "__main__": | |
try: | |
regex = sys.argv[1] |
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 socket,select | |
import argparse | |
import os | |
import mimetypes | |
import time | |
class IOLoop: | |
def __init__(self,server): | |
self.clients = {} | |
self.server = server |
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 | |
from os.path import * | |
import socket,select | |
import mimetypes | |
import argparse | |
import os | |
class httpBadRequestError(Exception): | |
pass |
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
-module(chatroom). | |
-export([run/1,worker/2,client_listener/2]). | |
client_listener(Client,Sock) -> | |
case gen_tcp:recv(Sock,0) of | |
{ok,Pack} -> | |
Client ! {sendmsg,Pack}, | |
client_listener(Client,Sock); | |
Other -> | |
Other |
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
-module(http_parser). | |
-export([run/1,continue/2]). | |
-define(PATH_RESERVED_CHARS,"!*'();:@&=+$,/?%#[]"). | |
is_ctl(C) -> | |
(((0 =< C) and (8 >= C)) | |
or ((11 =< C) and (31 >= C)) | |
or (C == 127)). |
OlderNewer