Skip to content

Instantly share code, notes, and snippets.

View kaka19ace's full-sized avatar

kaixiang zhong kaka19ace

View GitHub Profile
@kaka19ace
kaka19ace / test_gevent_idle.py
Last active May 13, 2019 06:40
test_gevent_idle.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Output Example:
start: num=0 st=1557729555989
start: num=1 st=1557729555989
start: num=2 st=1557729555989
import json
class StatusCodeField(int):
def __new__(cls, status_code, message):
obj = int.__new__(cls, status_code)
obj.message = message
return obj
@kaka19ace
kaka19ace / test_metaclass.py
Created November 3, 2015 16:35
test_metaclass
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file test_metaclass.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date Nov 03 2015
# @brief
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file models/base.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date
# @brief
#
from sqlalchemy.ext.declarative import (
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file model/model/base.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date
# @brief
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file base.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date Jun 13 2015
# @breif
#
@kaka19ace
kaka19ace / curl_request.py
Last active June 6, 2020 18:37
using pycurl request (support multi request)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file curl_request.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date Jan 10 2015
# @breif learn from human_curl
# @refrences:
# http://pycurl.sourceforge.net/doc/curlmultiobject.html
# http://curl.haxx.se/libcurl/c/curl_multi_info_read.html
@kaka19ace
kaka19ace / mysql.service-systemd
Created November 17, 2014 07:09
mysql service systemd script sample - For CentOS 7
#
# Simple MySQL systemd service file
#
# systemd supports lots of fancy features, look here (and linked docs) for a full list:
# http://www.freedesktop.org/software/systemd/man/systemd.exec.html
#
# Note: this file ( /usr/lib/systemd/system/mysql.service )
# will be overwritten on package upgrade, please copy the file to
#
# /etc/systemd/system/mysql.service
@kaka19ace
kaka19ace / mongo-init-ubuntu
Created November 15, 2014 10:46
For ubuntu 14.04 sample
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@kaka19ace
kaka19ace / gevent_zmq_redis_demo.py
Last active June 17, 2020 04:06
gevent with zmq and redis tasks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file gevent_zmq_redis_demo.py
# @author kaka_ace <xiang.ace@gmail.com>
# @date Tue Oct 14 2014
"""
fetures: there are two concurrent tasks
1. From Redis server, Getting the notify msg with BLPOP operation,