docker stack deploy a multi overlay network with mutli service.
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 sys | |
import psycopg2 | |
import psycopg2.extras | |
conn = psycopg2.connect("host=localhost port=5433 dbname=keycloak user=keycloak password=keycloak") | |
with conn.cursor(cursor_factory=psycopg2.extras.DictCursor) as cur: | |
cur.execute('show pool_nodes') | |
result = cur.fetchall() | |
result = sorted(result, key=lambda x:x['hostname']) | |
#print result |
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
db.monitoringTest.drop() | |
while(true) { | |
for(i = 0; i < 1000 ; i++) { | |
db.monitoringTest.insert({'i':i}) | |
} | |
for(i = 0; i < 1000 ; i++) { | |
db.monitoringTest.update({'i':i}, {$set:{'text':'text'}}) | |
} | |
cursor = db.monitoringTest.find() | |
while(cursor.hasNext()) { |
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
# -*- coding: utf-8 -*- | |
from flask import Flask, session | |
app = Flask(__name__) | |
app.config['SECRET_KEY']= 'session123' | |
app.config['SESSION_COOKIE_PATH'] = '/count/deep' | |
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
function TrimEndLines() | |
let cursor = getpos(".") | |
:%s#\($\n\s*\)\+\%$## | |
call setpos('.', cursor) | |
endfunction | |
au BufWritePre *.py call TrimEndLines() |
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 time | |
import logging | |
from multiprocessing import Process, Pipe, Queue | |
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s|%(levelname)-5.5s|%(processName)-10s| %(message)s') | |
logger = logging.getLogger() | |
def master(): | |
logger.info('master start') |
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 wrapt | |
import inspect | |
@wrapt.decorator | |
def pass_through(wrapped, instance, args, kwargs): | |
print "call pass_through", wrapped, instance | |
return wrapped(*args, **kwargs) | |
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
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import random | |
import logging | |
from multiprocessing import Process, Queue | |
#formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s|%(levelname)4s|%(processName)-10s| %(message)s') | |
logger = logging.getLogger() |
動態render cells 透用style, merged.
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 functools | |
import inspect | |
import time | |
import random | |
def memorize(keyfn, scenario='default', timeout=300): | |
def wrapper(fn): | |
_cached = {} |