Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
def namedlist(typename, field_names): | |
"""Returns a new subclass of list with named fields. | |
>>> Point = namedlist('Point', ('x', 'y')) | |
>>> Point.__doc__ # docstring for the new class | |
'Point(x, y)' | |
>>> p = Point(11, y=22) # instantiate with positional args or keywords | |
>>> p[0] + p[1] # indexable like a plain list | |
33 | |
>>> x, y = p # unpack like a regular list |
\set ON_ERROR_STOP on | |
-- The strategy for permissions will be: | |
-- – Assign all permissions to the owner. | |
-- – If a table owner does not match the schema name, assign all permissions | |
-- the role with the same name as the schema. | |
-- – Assign all permissions on all objects to tm_cz, which even needs to | |
-- drop and create tables in some cases. | |
-- — Assign read/usage permissions on all tables, views, sequences and | |
-- functions to biomart_user on all non-ETL schemas. | |
-- – Assign insert,delete,update permissions on all tables on searchapp. |
# -*- coding: utf-8 -*- | |
""" | |
Python logging tuned to extreme. | |
""" | |
__author__ = "Mikko Ohtamaa <[email protected]>" | |
__license__ = "MIT" |
def set_proc_name(newname): | |
from ctypes import cdll, byref, create_string_buffer | |
libc = cdll.LoadLibrary('libc.so.6') | |
buff = create_string_buffer(len(newname)+1) | |
buff.value = newname | |
libc.prctl(15, byref(buff), 0, 0, 0) |
from time import sleep | |
import tornado | |
from multiprocessing.pool import ThreadPool | |
_workers = ThreadPool(10) | |
class BackgroundMix(tornado.web.RequestHandler): | |
"""将block任务放入线程池中执行 | |
EXAMPLE: | |
# blocking task like querying to MySQL |
#!/usr/bin/env python | |
# | |
# Copyright 2009 Facebook | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may | |
# not use this file except in compliance with the License. You may obtain | |
# a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
license: gpl-3.0 | |
redirect: https://observablehq.com/@mbostock/world-tour |
# Copy the following and place it a file called Leiningen.sublime-build in the Sublime user packages folder (~/.config/sublime-text-2/Packages/User on Linux). | |
# Select this as the build system for the project using Tools/Build System/Leiningen. | |
# You can then bring up the Sublime Command Palette (ctrl+shift+P on Windows/Linux) and issue any of the commands # (build, documentation, clean, run, test, etc). By default, build is bound to ctrl+b and run to ctrl+shift+b. | |
{ | |
"cmd": ["lein", "compile", ":all"], | |
"working_dir": "$project_path", | |
"variants": [ | |
{ "cmd": ["lein", "marg", "-m", "-d", "docs"], |
#------------------------------------------------------------------------------ | |
# Make things VirtualEnv aware (Linux version). | |
# More info: http://www.swegler.com/becky/blog/2011/08/28/python-django-mysql-on-windows-7-part-3-ipython-virtual-environments/ | |
# add this to the end of ipython_config | |
# (or course, for virtualenvs created via --no-site-packages, it would | |
# be much easier just to install iPython) | |
# | |
# Also consider sourcing this file from ipython_config with execfile(). | |
# | |
#------------------------------------------------------------------------------ |