Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
| import sys | |
| from gevent import server | |
| from gevent.baseserver import _tcp_listener | |
| from gevent.monkey import patch_all; patch_all() | |
| from multiprocessing import Process, current_process, cpu_count | |
| def note(format, *args): | |
| sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args)) |
| # zabbix_get.py : Python port of zabbix_get | |
| # http://www.zabbix.com/documentation/1.8/protocols/agent | |
| # http://www.zabbix.com/wiki/doc/tech/proto/zabbixagentprotocol | |
| import argparse | |
| import socket | |
| import struct | |
| import sys | |
| def str2packed(data): |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.Wensheng Wang, 10/1/11
Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html
When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| #!/usr/bin/env python | |
| #coding=utf-8 | |
| # | |
| # Generate a list of dnsmasq rules with ipset for gfwlist | |
| # | |
| # Copyright (C) 2014 http://www.shuyz.com | |
| # Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules | |
| import urllib2 | |
| import re |
| 'Emulate max() as fully as possible in pure Python.' | |
| # https://stackoverflow.com/questions/69997857/implementation-of-max-function-in-python/69997876#69997876 | |
| # https://github.com/python/mypy/issues/7231 | |
| from typing import TypeVar, Any, Iterator, Iterable, Optional | |
| from typing import Union, Protocol, Callable, cast, Tuple, overload | |
| class SupportsGT(Protocol): |