Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# chkconfig: 23 90 10
# Description: Quickly hacked together bigcouch init script for CentOS systems.
. /etc/init.d/functions
PID_FILE=/var/run/bigcouch.pid
BIGCOUCH_BIN=/opt/bigcouch/bin/bigcouch
SUBSYS_LOCK_FILE=/var/lock/subsys/bigcouch
@mike-zhang
mike-zhang / httpShareWithTrace.go
Created October 10, 2012 14:25
http Share With Trace (golang)
/*
File : httpShareWithTrace.go
Author : Mike
E-Mail : Mike_Zhang@live.com
*/
package main
import (
"net/http"
"os"
"strings"
@mike-zhang
mike-zhang / watch_eth0.sh
Created October 15, 2012 06:36
定时显示特定网卡信息供查看
#! /bin/sh
if [ -f '/usr/bin/watch' ]
then
watch -n 1 -d ifconfig eth0
#watch ifconfig eth0
else
#while [ 1 ];do ifconfig eth0 ;sleep 1;clear;done
while [ 1 ]
do
@mike-zhang
mike-zhang / find_if_inMemeberFun.cpp
Created October 18, 2012 08:08
STL find_if in member function
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
using namespace std;
class CMyTest
{
public:
bool IsOdd ( int i)
@mike-zhang
mike-zhang / debugTest.cpp
Created October 24, 2012 15:13
使用预处理进行调试(c++ demo)
#include <iostream>
//#define NDEBUG // or : g++ -DNDEBUG debugTest.cpp -o debugTest
#include <cassert>
using namespace std;
int main()
{
cout<<__FILE__<<endl;
cout<<__LINE__<<endl;
@mike-zhang
mike-zhang / ptrSwap.cpp
Created October 25, 2012 15:33
交换两个指针(c++)
#include <iostream>
using namespace std;
//using pointer
void ptrSwap1(int **pa,int **pb)
{
int *ptmp = *pa;
*pa = *pb;
*pb = ptmp;
@mike-zhang
mike-zhang / wordCount1.cpp
Created November 5, 2012 15:21
STL map test : word count
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
map<string,int> dict;
string word;
@mike-zhang
mike-zhang / record1.py
Created November 8, 2012 06:34
抓取linux桌面视频
#! /bin/bash
t1=`date +%Y%m%d%H%M`
path1="/tmp/out_$t1.mpg"
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq $path1
@mike-zhang
mike-zhang / netstatWatch.sh
Created November 9, 2012 08:49
定时显示与特定主机的连接
#! /bin/bash
r_host='10.11.1.100'
if [ -f '/usr/bin/watch' ]
then
watch -n 1 -d "netstat -an | grep $r_host"
else
while [ 1 ]
do
@mike-zhang
mike-zhang / streamIteratorTest.cpp
Created November 11, 2012 23:24
流迭代器和算法一起使用
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
istream_iterator<int> cin_it(cin);