This file contains 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
<uwsgi> | |
<socket>127.0.0.1:9090</socket> | |
<master/> | |
<workers>1</workers> | |
<vhost/> | |
<callable>app</callable> | |
<max-requests>10000</max-requests> | |
<harakiri>30</harakiri> | |
<memory-report/> | |
<logdate/> |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import cookielib | |
import urllib | |
import urllib2 | |
import re | |
url_login = 'http://f.10086.cn/im/login/inputpasssubmit1.action' | |
url_logout = 'http://f.10086.cn//im/index/logoutsubmit.action?t=' |
This file contains 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
include "vhost/au92.vcl"; | |
#允许刷新缓存的 ip | |
acl purgeAllow { | |
"127.0.0.1"; | |
"172.16.101.33"; | |
} | |
#/acl iplist############################################################## |
This file contains 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
backend au92 { | |
.host = "www.au92.com"; | |
.port = "80"; | |
.connect_timeout = 600s; | |
.first_byte_timeout = 600s; | |
.between_bytes_timeout = 600s; | |
.max_connections = 800; | |
} | |
This file contains 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
# Configuration file for varnish | |
# | |
# /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK | |
# to be set from this shell script fragment. | |
# | |
# Should we start varnishd at boot? Set to "yes" to enable. | |
START=yes | |
# Maximum number of open files (for ulimit -n) |
This file contains 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:utf-8 -*- | |
import libxml2dom, sys, requests | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
def affect(points, keep_ratio, ratio, power): | |
keep = points * keep_ratio | |
if ratio >= 1.: return points | |
return keep + (points - keep) * pow(ratio, power) |
This file contains 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:utf-8 -*- | |
import requests #引入requests第三方库支持 | |
#定义一个函数,下载torrage.com上的文件 | |
def download(): | |
_url = 'http://torrage.com/sync/20130820.txt' #要下载的文件 | |
_content = requests.get(_url, timeout=3).content #通过requests抓取到要下载的文件的具体内容 | |
open('20130820.txt', 'wb').write(_content) #保存到e:\python\01hg\bt-search\这个目录下(需提前建好这个目录) | |
if __name__ == "__main__": |
This file contains 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:utf-8 -*- | |
from pymongo import Connection #引入Mongo支持 | |
#连接Mongo | |
mongo = Connection(host='127.0.0.1', port=27017) | |
db = mongo.bt #连接bt这个数据库,没有会自动新建 | |
#读取下载的文件内容 | |
def read_data(): | |
_file = open('20130820.txt', 'rb').readlines() |
This file contains 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:utf-8 -*- | |
import requests, os, hashlib | |
from pymongo import Connection #引入Mongo支持 | |
#连接Mongo | |
mongo = Connection(host='127.0.0.1', port=27017) | |
db = mongo.bt #连接bt这个数据库,没有会自动新建 | |
#保存下载的BT种子 | |
def save_file_to_disk(content, info_hash): |
This file contains 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:utf-8 -*- | |
import libtorrent as lt, hashlib | |
from pymongo import Connection | |
def file_path(info_hash): | |
'''get new file path and name''' | |
_md5 = hashlib.md5(info_hash).hexdigest() | |
return {'path':'%s/%s/'%(_md5[0:2], _md5[2:5]), 'file_name':'%s.torrent'%_md5} | |
#解析BT文件并更新对应信息到Mongo数据库 |