Skip to content

Instantly share code, notes, and snippets.

View c4pt0r's full-sized avatar

dongxu c4pt0r

View GitHub Profile
# A sample Makefile for building Google Test and using it in user
# tests. Please tweak it to suit your environment and project. You
# may want to move it to your project's root directory.
#
# SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
#ifndef TSTRING_H
#define TSTRING_H
#include <string.h>
#include <string>
#undef DISALLOW_EVIL_CONSTRUCTORS
#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
void operator=(const TypeName&)
@c4pt0r
c4pt0r / pot.py
Created April 13, 2012 10:43
pot
#encoding=utf-8
import tornado
import pytyrant
import tornado.web
import tornado.ioloop
import json as simplejson
tt_server = None
class PutHandler(tornado.web.RequestHandler):
1) "account:history:huangdx"
2) "account:history:shidh"
3) "account:zhaojing"
4) "account:id:10"
5) "account:id:11"
6) "account:id:12"
7) "account:id:13"
8) "account:id:14"
9) "account:id:15"
10) "account:id:16"
import os
import jsonrpclib
from mongoengine import *
connect('dict')
class Page(Document):
created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
word = db.StringField(max_length=255, required=True, unique = True)
#encoding=utf-8
#simple http/sockJS comet server written by huangdx
import tornado.ioloop
import tornado.web
import sockjs.tornado
import json
class TestHandler(tornado.web.RequestHandler):
def get(self):
['dishuang@rd.netease.com', 'wangzhiqiang688@126.com', 'chyangny@163.com', 'baguolj@163.com', 'wordbook1', 'guotianni@163.com', 'dengxinjs@163.com', 'hi_yod@126.com', 'wayneteng87@yahoo.com.cn', 'shenli3514', 'caryonline@163.com', 'fred3k@126.com', 'wushujuanjany@163.com', 'shenli3514@163.com', 'dogshuang@163.com', 'lix7411@126.com', 'cuiwanyu1218@163.com', 'jiaoxiyin@163.com', 'c4pt0r@163.com', 'dingzongqiu@126.com', 'wujiaquanyod@163.com', 'ly-no9@163.com', 'daviddengcn', 'liuqiurunyod@163.com', 'feihong750@163.com', 'c4pt0r@126.com', 'chongynj@163.com', 'jimhuman@163.com', 'ljg-578@163.com', 'omikron', 'no_rain_today@126.com', 'kissgod97@163.com', 'wuyinghui97@163.com', 'wordbook1@163.com', 'nikanaa@163.com', 'shuke987@163.com', 'kingcardlg@163.com', 'mmwwwwwwwwwwwwwwwm@163.com', 'liu95liang@126.com', 'wanghuiyod@126.com', 'wanglei00163@163.com', 'linminhuanyod@163.com', '170257702@163.com', 'lyn_imme@163.com', 'mrbean_mrbean@126.com', 'kg-119911', 'yoheka@yeah.net', 'mdict1@163.com', 'qipengbupt@163.com',
@c4pt0r
c4pt0r / pysqs.py
Created August 29, 2012 00:32
pysqs
#!/usr/bin/env python
# * simple RESTful http queue service *
# written by c4pt0r <huangdongxu1987@gmail.com>
# date 2012-8-29
import os
import tornado.ioloop
import tornado.web
import tornado.gen
#encoding=utf-8
import os
import sys
import redis
def read_list(filename):
c = open(filename).read()
return [s.lstrip().rstrip() for s in c.split('\n')]
r = redis.Redis('nb391x.corp.youdao.com', 6379)
@c4pt0r
c4pt0r / log.c
Created September 21, 2012 08:01
simple logger
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include "log.h"