$ python t.py
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (2): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (3): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (4): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (5): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (6): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (7): example.net
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (8): example.net
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 __future__ import print_function | |
import dis | |
def f1(): | |
x = 'a' * 20 | |
y = 'a' * 20 | |
return x is y |
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 lxml import etree as ET | |
from io import BytesIO | |
gb2312_xml = u"""<?xml version="1.0" encoding="gb2312" ?> | |
<node>中文</node>""".encode("gb2312") | |
print(ET.tostring(ET.parse(BytesIO(gb2312_xml)), encoding="utf-8")) |
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
upstream api_example_net { | |
server api.example.net:4000; | |
keepalive 600; | |
} | |
proxy_cache_path /var/cache/nginx/tag levels=1:2 keys_zone=tag:10m inactive=1d max_size=10g; | |
server { | |
listen 80; | |
server_name api.example.net; |
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
upstream hurl_proxy { | |
server www.hurl.it; | |
keepalive 600; | |
} | |
server { | |
listen 80; | |
server_name hurl.example.com; | |
access_log /var/log/nginx/hurl_proxy.access.log; |
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 ast | |
from ast import Assign, Name, Call, Store, Load, Str, Num, List, Add, BinOp | |
from ast import Subscript, Slice, Attribute, GeneratorExp, comprehension | |
from ast import Compare, Mult | |
import codegen | |
import random | |
import sys | |
def random_string(minlength, maxlength): |
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
-- [[ Implementation of MergeSort --]] | |
-- merge an array split from p-q, q-r | |
merge = (A, p, q, r) -> | |
n1 = q - p + 1 | |
n2 = r - q | |
left = {} | |
right = {} | |
for i = 1, n1 |
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 bottle | |
app = bottle.Bottle() | |
@app.route('/') | |
def index(): | |
return "Hello world!" |
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
ppa:saltstack/salt | |
ppa:chris-lea/uwsgi | |
ppa:nginx/stable | |
ppa:chris-lea/redis-server |
NewerOlder