Skip to content

Instantly share code, notes, and snippets.

View 123Daoxyz's full-sized avatar

Daoxyz 123Daoxyz

  • null
  • LA@USA
View GitHub Profile
@123Daoxyz
123Daoxyz / Wordpress_Theme_Mygreen1.0
Created August 19, 2011 21:35
Wordpress_Theme_Mygreen1.0
My first wordpress theme..............
@123Daoxyz
123Daoxyz / calculator.cc
Last active December 21, 2015 02:09
a calculator interpretor,referenced from <Programming:Principles and Practice Using C++ >.
/* Calculation:
* Statement
* Print
* Quit
* Calculation Statement
*
* Statement:
* Declaration
* Expression
*
@123Daoxyz
123Daoxyz / std_lib_facilities.h
Created August 14, 2013 16:45
A common header file for the calculator interpretor,referenced from <Programming:Principles and Practice Using C++ >.
/*
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.
@123Daoxyz
123Daoxyz / client part
Created April 8, 2014 16:57
udp server based on tornado
#!/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
@123Daoxyz
123Daoxyz / simplelogging.py
Last active August 29, 2015 14:03
logging replacement for python std one
# get from goagent
class SimpleLogging(object):
CRITICAL = 50
FATAL = CRITICAL
ERROR = 40
WARNING = 30
WARN = WARNING
INFO = 20
DEBUG = 10
NOTSET = 0
@123Daoxyz
123Daoxyz / logging.py
Created August 6, 2014 05:13
logging module used in python project
#! /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这个字段。
@123Daoxyz
123Daoxyz / futures_test.py
Created October 24, 2015 09:06 — forked from lbolla/futures_test.py
Tornado and concurrent.futures
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
import tornado.ioloop
import tornado.web
EXECUTOR = ThreadPoolExecutor(max_workers=4)
@123Daoxyz
123Daoxyz / logging snippets
Created August 14, 2016 12:45
python logging snippets
#!/usr/bin/env python
# encoding: utf-8
import logging
import sys
FMT = (
'[%(levelname)s][%(name)s:%(process)d][%(asctime)s]' +
': %(message)s')
@123Daoxyz
123Daoxyz / on_my_shell_snippets.sh
Last active August 15, 2016 15:31
shell snippets
# handy dirty funcs used frequently
```
- ps aux | grep mysqld | grep -v grep | awk '{print $2}' | xargs kill -9 ; #kill the programe by name
```
@123Daoxyz
123Daoxyz / 0_reuse_code.js
Created February 4, 2017 02:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console