mysql> create table t (id integer primary key, f1 float, f2 float(10,4));
mysql> insert into t (id, f1, f2) values (1, 0.0001, 0.0001);
mysql> select f1, f1=0.0001, f1=0.0001e0, f2, f2=0.0001, f2=0.0001e0 from t;
+--------+-----------+-------------+--------+-----------+-------------+
| f1 | f1=0.0001 | f1=0.0001e0 | f2 | f2=0.0001 | f2=0.0001e0 |
+--------+-----------+-------------+--------+-----------+-------------+
| 0.0001 | 0 | 0 | 0.0001 | 1 | 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
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 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 sys | |
import os | |
import io | |
import traceback | |
import json | |
import pathlib | |
import sub | |
try: |
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
Run uwsgi | |
uwsgi --wsgi-file=mt_sample.py --threads 8 --workers 4 --max-requests 40 --http-socket=:8000 --master --min-worker-lifetime=7 -L | |
Run hey[1] | |
hey -c 32 -z 10m 'http://127.0.0.1:8000/' | |
[1] hey: https://github.com/rakyll/hey |
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
package main | |
import ( | |
"fmt" | |
"github.com/ugorji/go/codec" | |
) | |
var mh = codec.MsgpackHandle{} |
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
# https://github.com/python/cpython/pull/107374 | |
import sys | |
import textwrap | |
import timeit | |
filename = "Objects/unicodeobject.c" | |
if len(sys.argv) > 1: | |
filename = sys.argv[1] |
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
diff -r ffdfb1066ac6 contrib/win32/hg.bat | |
--- a/contrib/win32/hg.bat Thu Mar 02 15:34:45 2023 +0100 | |
+++ b/contrib/win32/hg.bat Wed Jun 28 18:53:44 2023 +0900 | |
@@ -5,6 +5,7 @@ | |
set HG=%~f0 | |
set PYTHONLEGACYWINDOWSSTDIO=1 | |
+set PYTHONLEGACYWINDOWSFSENCODING=1 | |
rem Use a full path to Python (relative to this script) if it exists, |
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
"""Flask extension utility.""" | |
from flask.sessions import SessionInterface, SessionMixin | |
from werkzeug.contrib.cache import MemcachedCache | |
import memcache # Use https://code.launchpad.net/~songofacandy/python-memcached/mixin-threading | |
def setup_cache(app): | |
""" | |
Setup ``app.cache``. |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
"""myprofiler - Casual MySQL Profiler | |
https://github.com/methane/myprofiler | |
""" | |
import os | |
import sys |
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 time import sleep | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, asynchronous, RequestHandler | |
from multiprocessing.pool import ThreadPool | |
_workers = ThreadPool(10) | |
def run_background(func, callback, args=(), kwds={}): | |
def _callback(result): |
NewerOlder