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 logging, logging.config | |
import sys | |
LOGGING = { | |
'version': 1, | |
'handlers': { | |
'console': { | |
'class': 'logging.StreamHandler', | |
'stream': sys.stdout, | |
} |
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 | |
u""" | |
1.4 字符串对齐 | |
字符串方法 ljust rjust center 参数: int 对齐符号数目 str 可以选的对齐占位符,默认为空格 | |
""" | |
# 1.9 简化string translate方法使用流程 | |
import string |
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
#运行用户 | |
user nobody; | |
#启动进程,通常设置成和cpu的数量相等 | |
worker_processes 1; | |
#全局错误日志及PID文件 | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; |
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 | |
import re | |
def lex(characters, token_exprs): | |
pos = 0 | |
tokens = [] | |
while pos < len(characters): | |
match = None |
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 | |
class RC4: | |
def __init__(self,public_key = None): | |
if not public_key: | |
public_key = 'none_public_key' | |
self.public_key = public_key | |
self.index_i = 0; | |
self.index_j = 0; |
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 argparse | |
from gevent import monkey | |
monkey.patch_socket() | |
import logging | |
logging.basicConfig(level=logging.DEBUG) |
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 __future__ import print_function | |
import re | |
import sys | |
filter = re.compile(r'site-packages/requests/.*') | |
def tracer(frame, event, args): |
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 tornado import gen | |
from tornado import httpclient | |
from tornado import httputil | |
from tornado import ioloop | |
from tornado import websocket | |
import json |
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
wrk.path = "/rest/ping" | |
wrk.method = "POST" | |
wrk.body = "id=7579764573763278289&platformid=ANDROID&version=1.0.0" | |
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded" | |
wrk.headers["deviceid"] = "354435052821931" | |
wrk.headers["Accept"] = "application/json" | |
logfile = io.open("wrk.log", "w"); | |
local cnt = 0; |
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
curl -w %{time_connect}:%{time_starttransfer}:%{time_total} -X POST 'http://service-uri' -H 'Content-Type: application/json' --data 'post-data' |