Skip to content

Instantly share code, notes, and snippets.

View kaka19ace's full-sized avatar

kaixiang zhong kaka19ace

View GitHub Profile
@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 / 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
/*
* leetcode Sort List
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <iostream>
/*
* @file quick.cpp
* @author kaka_ace <[email protected]>
* @date Sun May 18 23:19:00 2014
* @brief quick sort cpp with template
* when sort list length is less than 10, i used insert sort
*/
#include <iostream>
using namespace std;
/*
copy from rtmpd 781
*/
#ifndef _LINKEDLIST_H
#define _LINKEDLIST_H
template<typename T>
struct LinkedListNode {
LinkedListNode<T> *pPrev;
#!/bin/bash
# 一次向阿里云提交工单反映问题时,对方提供的测试脚本, 嘻嘻, 借用了,比我写的py脚本还方便
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth1
echo
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@kaka19ace
kaka19ace / upyun_sdk_update_cache.py
Last active August 29, 2015 13:58
又拍云 python sdk 添加更新缓存的接口
# 又拍云 python sdk 添加更新缓存的接口
def update_cache(self, urls):
"""
>>> url1 = "http://kaka.b0.upaiyun.com/kaka_001.flv"
>>> url2 = "http://kaka.b0.upaiyun.com/kaka_002.flv"
>>> urls = [url1, url2]
>>> res = up.update_cache(urls)
>>> return tuple (status, content)
"""
#!/usr/bin/python
#coding=utf-8
import cookielib
import urllib
import urllib2
import json
import base64
from urlparse import urlparse
--http://lua-users.org/lists/lua-l/2010-11/msg00241.html
--Mike
-- Allocate, traverse and collect lots of small objects.
-- Shows cache thrashing by the GC. Public domain.
local N = 14000000
local T
local function alloc(text)