This file contains hidden or 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
<source> | |
type in_tail | |
tag apache.t | |
</source> | |
<match apache.t> | |
type parser | |
format apache | |
tag apache.p | |
</match> |
This file contains hidden or 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, division, absolute_import | |
import flask | |
app = flask.Flask(__name__) | |
@app.route('/') | |
def index(): | |
return u'Hello' | |
@app.after_request |
This file contains hidden or 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 time | |
def query_10k(cur): | |
t = time.time() | |
for _ in range(10000): | |
cur.execute("SELECT 1,2,3,4,5") | |
res = cur.fetchall() | |
assert len(res) == 1 | |
assert res[0] == (1,2,3,4,5) |
This file contains hidden or 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
$ python sample.py | |
...........................................................................................................................................................................................................................................................ERROR:sqlalchemy.pool.QueuePool:Exception closing connection None | |
Traceback (most recent call last): | |
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/sqlalchemy/pool.py", line 244, in _close_connection | |
self._dialect.do_close(connection) | |
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 411, in do_close | |
dbapi_connection.close() | |
AttributeError: 'NoneType' object has no attribute 'close' | |
Traceback (most recent call last): | |
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run |
This file contains hidden or 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 gevent.monkey | |
gevent.monkey.patch_all() | |
import flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
app = flask.Flask(__name__) | |
app.debug = True | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root@localhost/test' | |
db = SQLAlchemy(app) |
This file contains hidden or 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 pymemcache.client | |
import time | |
client = pymemcache.client.Client(('localhost', 11211)) | |
for _ in range(1000): | |
for i in range(10000): | |
k = "foo%d" % i | |
x = str(time.time()) | |
if not isinstance(x, bytes): |
This file contains hidden or 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
using System; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace wsecho | |
{ | |
class MainClass | |
{ | |
static HttpListener listener; |
This file contains hidden or 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
// To run this test. | |
// $ go get github.com/garyburd/redigo/redis | |
// $ go test -bench=. | |
package main | |
import ( | |
"fmt" | |
"log" | |
"math/rand" |
This file contains hidden or 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
In [3]: filter? | |
Type: type | |
String Form:<class 'filter'> | |
Namespace: Python builtin | |
Docstring: | |
filter(function or None, iterable) --> filter object | |
Return an iterator yielding those items of iterable for which function(item) | |
is true. If function is None, return the items that are true. |
This file contains hidden or 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
In [2]: list. | |
list.append list.extend list.insert list.pop list.reverse | |
list.count list.index list.mro list.remove list.sort | |
In [2]: list.in | |
list.index list.insert | |
In [2]: list.index? | |
Type: method_descriptor | |
String Form:<method 'index' of 'list' objects> |