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
import requesocks as requests | |
session = requests.session() | |
session.proxies = {'http': 'socks5://127.0.0.1:7070','https': 'socks5://127.0.0.1:7070'} | |
s=session.get('https://www.facebook.com') | |
print s |
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 sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
# unsplash 全站下载脚本 | |
# 请先安装 requests ,BeautifulSoup | |
# pip install requests beautifulsoup4 | |
# 运行 python unsplash.py | |
# 输入最小页数和最大页数 |
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
from bs4 import BeautifulSoup | |
import requests | |
from PIL import image | |
import pytesseract | |
mysession = requests.Session() | |
url = 'http://110.249.223.91/hbhb/Default.aspx' | |
r = mysession.get(url,timeout=60*4) | |
c = r.content | |
mysoup = BeautifulSoup(c) |
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
// Generated by CoffeeScript 1.8.0 | |
var Bitfinex, crypto, qs, request; | |
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | |
request = require('request'); | |
crypto = require('crypto'); | |
qs = require('querystring'); |
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
from django.core.management.base import BaseCommand,CommandError | |
from myapp.models import * | |
class Command(BaseCommand): | |
def handle(self, *args, **options): | |
result_list = results.objects.exclude(value='') | |
i = 1 | |
for item in result_list: | |
patt = re.compile(u'^\d+\.\d+$|^\d+$') | |
maxvalue = item.re_monitor_info.max_value |
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
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
import os | |
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | |
#celery setting | |
from datetime import timedelta | |
CELERYBEAT_SCHEDULE = { | |
'add-every-30-seconds': { | |
'task': 'tasks.add', |
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
<div class="nav-collapse collapse pull-right"> | |
<ul class="nav"> | |
{% if request.user.is_authenticated %} | |
<li> | |
<a href="/settings">{{ request.user.username }}</a> | |
</li> | |
<li> | |
<a href="/logout">退出</a> | |
</li> |
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
def index(request): | |
data={} | |
#传递request参数有没有比这个更好的实现? | |
data['request'] = request | |
return render_to_response('index.html',data,context_instance=RequestContext(request)) | |
def signin(request): | |
data={} | |
if request.user.is_authenticated(): |
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
<?php | |
/** | |
* wechat php test | |
*/ | |
//define your token | |
define("TOKEN", "iambus"); | |
$wechatObj = new wechatCallbackapiTest(); | |
if (isset($_GET['echostr'])) { | |
$wechatObj->valid(); |
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
<?php | |
/** | |
* | |
*/ | |
class TopicViewModel extends ViewModel | |
{ | |
public $viewFields = array( | |
'topic' => array('id','title','content','last_replied_by','last_touched','created'), | |
'user' => array('username','nickname','avatar','uid','reputation', '_on' => 'topic.author_id=user.uid'), |