Skip to content

Instantly share code, notes, and snippets.

kafka-console-consumer.sh --topic gps-data-export --zookeeper 10.64.249.175:2181/kafka --consumer.config tmp.conf >data.log &
// tmp.conf: group.id=gps2orcl-qa
Couchbase DCP will compact several changes of the same document into one DCP event;
DCP will serialize the offset (vis state serializer) immediately when it determines the current offset.
That means, if you started the DCP, the state that's been serialized is the latest offset; not the offset that has been streamed.
In other words, DO NOT stop the streaming if the data has not been fully streamed.
docker run --detach -p 8091:8091 -p 8092:8092 -p 8093:8093 -p 11207:11207 -p 11210:11210 -p 11211:11211 -p 18091:18091 -p 18092:18092 couchbase:3.0.3
docker run --net=host couchbase:3.0.3
sudo apt-get update;
sudo apt-get install apt-transport-https ca-certificates apparmor
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-engine
sudo usermod -a -G docker `whoami`
sudo service docker start
@stanley-shi
stanley-shi / perferred-apache-mirror.py
Last active April 12, 2017 17:10
How to get the preferred download address for an apache component
# this script prints the preferred apache mirror and path_info to download components;
import urllib
import json
url="https://www.apache.org/dyn/closer.cgi?as_json=1"
#url='https://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz?as_json=1'
result=json.load(urllib.urlopen(url))
print result['preferred']
print result['path_info']
@stanley-shi
stanley-shi / gist:41409a581fd737b5971b
Created July 23, 2014 08:20
Search for a string from a stream
public static class MyInt {
public MyInt(int i) {
data = i;
}
int data;
}
public static long getFirstIndex(String str, InputStream is)
throws IOException {
byte[] bstr = str.getBytes();
@stanley-shi
stanley-shi / RevertLinkedList
Created July 23, 2014 03:13
RevertLinkedList
public Class RevertLinkedList{
public static class LinkedNode{
int data;
LinkedNode next;
}
public LinkedNode revert(LinkedNode head){
LinkedNode result = null;
while(head!=null){
LinkedNode tmp=head.next;