This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package funny; | |
import java.util.*; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.*; | |
/** | |
* | |
* @author zhouji | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger () | |
{ | |
time=`TZ="Asia/Shanghai" date +"%Y-%m-%d %T"`; | |
echo "[$time] $*" | |
} | |
filesize () | |
{ | |
/bin/ls -alF "$1" | awk '{print $5}' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.ByteBuffer; | |
import java.util.Random; | |
public class BufferPerformanceComparison { | |
public final static int MEGA_BYTE = 1024 * 1024; | |
public final static long GIGA_BYTE = MEGA_BYTE * 1024; | |
private final ByteBuffer heapByteBuffer; | |
private final ByteBuffer offHeapByteBuffer; | |
private final long dataToLoad; | |
private final int bufferSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A script for download books from motie | |
import java.util.regex.Pattern | |
content= "" | |
def getIndex(indexURL){ | |
(indexURL.toURL().text =~ /a href="(\/book\/[0-9]+_[0-9]+)" >第/ ).each{ a, b -> | |
getPage("http://www.motie.com/"+b) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A thin kestrel client that wraps Memcached (libmemcached extension) | |
* | |
* @author Bill Shupp <hostmaster@shupp.org> | |
* @copyright 2010-2011 Empower Campaigns | |
*/ | |
class EC_KestrelClient | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'python.vim' | |
Bundle 'taglist.vim' | |
Bundle 'TWiki-Syntax' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
int min_idx(float * ratio, int * idx,int size){ | |
float min_weight = 10000000.0f; | |
int min_idx = 0; | |
for( int i = 0 ; i < size ; i++){ | |
float weight = idx[i]/ratio[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f=open('/home/zhouji/temp/out5','r') | |
idx=0 | |
ctn=set() | |
for line in f: | |
ss=line.split("\001") | |
s=ss[0]+ss[1] | |
idx=idx+1 | |
if not s in ctn : | |
print line.replace("\001","\\001").replace("\002","\\002").replace("\003","\\003") | |
ctn.add(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int QueueCluster::Send(const char * queueName, const char * data, int timeout){ | |
int rtn = 0; | |
uint startTime = time(NULL); | |
int elapsedTime; | |
int retryCount = 0; | |
do{ | |
QueueServer * svr = SelectQueueServer(); | |
if( svr != NULL ){ | |
rtn = svr->Send(queueName,data,timeout); | |
if( rtn == SEND_SUCCESS ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int test1(){ | |
cout<< " OK " << endl; | |
KestrelServer ks("localhost",22133); | |
int max = 1000000; | |
struct timeval start, end; | |
long mtime, seconds, useconds; | |
gettimeofday(&start, NULL); | |
int count = 0; |
OlderNewer