国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
""" | |
Requires: | |
pip install click sqlparse | |
""" | |
import re | |
from textwrap import indent, dedent | |
import click | |
import sqlparse |
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { |
In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.
All the examples use demical types, except for the original value, which is automatically casted as a float.
To set the context of what we are working with, let's start with an original value.
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:
""" | |
If you're using Celery with the gevent worker and a Flask app, | |
you may have noticed that you're unsuccessful in having the | |
tasks execute within your Flask app's app_context. Normally, | |
you can do this | |
with app.app_context(): | |
celery.start() | |
...but...doesn't appear to work with the gevent worker pool. |
import os | |
def split(filehandler, delimiter=',', row_limit=10000, | |
output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
""" | |
Splits a CSV file into multiple pieces. | |
A quick bastardization of the Python CSV library. | |
Arguments: |