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
My first wordpress theme.............. |
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
/* Calculation: | |
* Statement | |
* Quit | |
* Calculation Statement | |
* | |
* Statement: | |
* Declaration | |
* Expression | |
* |
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
/* | |
simple "Programming: Principles and Practice using C++" course header to | |
be used for the first few weeks. | |
It provides the most common standard headers (in the global namespace) | |
and minimal exception/error support. | |
Students: please don't try to understand the details of headers just yet. | |
All will be explained. This header is primarily used so that you don't have | |
to understand every concept all at once. |
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 | |
# encoding: utf-8 | |
import time | |
import socket | |
from tornado.iostream import IOStream | |
from tornado.ioloop import IOLoop | |
from tornado import stack_context | |
import functools | |
import collections |
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
# get from goagent | |
class SimpleLogging(object): | |
CRITICAL = 50 | |
FATAL = CRITICAL | |
ERROR = 40 | |
WARNING = 30 | |
WARN = WARNING | |
INFO = 20 | |
DEBUG = 10 | |
NOTSET = 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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
log模块,这里利用了一些sys.modules和python系统库查找的一些trick。 | |
log模块第一次导入的时候,是作为一个文件被查找到的。查找成功后,文件会跑一个生成log实例的逻辑,然后把它加入到全局sys.modules字典里面。 | |
以后所有模块的`import log`动作都会绕开文件查找的过程,直接在sys.modules里面找这个模块。 | |
""" | |
#FIXME tornado的日志记录有点问题,经常会和testing的模块的日志混在一起。比如slave_ok这个字段。 |
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 concurrent.futures import ThreadPoolExecutor | |
from functools import partial, wraps | |
import time | |
import tornado.ioloop | |
import tornado.web | |
EXECUTOR = ThreadPoolExecutor(max_workers=4) |
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 | |
# encoding: utf-8 | |
import logging | |
import sys | |
FMT = ( | |
'[%(levelname)s][%(name)s:%(process)d][%(asctime)s]' + | |
': %(message)s') |
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
# handy dirty funcs used frequently | |
``` | |
- ps aux | grep mysqld | grep -v grep | awk '{print $2}' | xargs kill -9 ; #kill the programe by name | |
``` |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer