Skip to content

Instantly share code, notes, and snippets.

View kaka19ace's full-sized avatar

kaixiang zhong kaka19ace

View GitHub Profile
/*
* leetcode Sort List
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <iostream>
@kaka19ace
kaka19ace / nginx-init
Last active August 29, 2015 14:06
nginx initscript for Ubuntu 14.04
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@kaka19ace
kaka19ace / redis-server-init
Created October 1, 2014 15:37
For Ubuntu 14.04
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@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 <[email protected]>
# @date Tue Oct 14 2014
"""
fetures: there are two concurrent tasks
1. From Redis server, Getting the notify msg with BLPOP operation,
@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 <[email protected]>
#
# 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 / 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 / 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 <[email protected]>
# @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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file base.py
# @author kaka_ace <[email protected]>
# @date Jun 13 2015
# @breif
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file model/model/base.py
# @author kaka_ace <[email protected]>
# @date
# @brief
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file models/base.py
# @author kaka_ace <[email protected]>
# @date
# @brief
#
from sqlalchemy.ext.declarative import (