Skip to content

Instantly share code, notes, and snippets.

@helayzhang
helayzhang / echo_server.js
Created February 16, 2014 14:06
Simple Echo server writen by node.js
var net = require('net');
var server = net.createServer(function (socket) {
socket.write('Echo server\r\n');
socket.pipe(socket);
});
server.listen(8888, '0.0.0.0');
@helayzhang
helayzhang / echo_server.py
Created February 16, 2014 14:00
Simple Echo server writen by Python .
#!/usr/bin/env python
"""
A simple echo server
"""
import socket
host = ''
port = 8888
@helayzhang
helayzhang / build_protobuf_android.sh
Created February 16, 2014 13:47
Build Google Protobuf library for android development. With android ndk stand alone tool chains.
PREFIX=`pwd`/protobuf/android
rm -rf ${PREFIX}
mkdir ${PREFIX}
export NDK=YOUR_NDK_ROOT
# 1. Use the tools from the Standalone Toolchain
export PATH=YOUR_NDK_STAND_ALONE_TOOL_PATH/bin:$PATH
export SYSROOT=YOUR_NDK_STAND_ALONE_TOOL_PATH/sysroot
@helayzhang
helayzhang / build_protobuf_ios.sh
Created February 16, 2014 13:41
Build Google Protobuf library for iOS development, include i386/armv7/armv7s/arm64/x86_64 arch.
#!/bin/bash
echo Building Google Protobuf for Mac OS X / iOS.
echo Use 'tail -f build.log' to monitor progress.
(
PREFIX=`pwd`/protobuf/ios
rm -rf ${PREFIX}
mkdir ${PREFIX}
mkdir ${PREFIX}/platform