Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@slfritchie
slfritchie / presentation.md
Created March 18, 2014 09:22
Erlang tracing, for the Riak source code reading series, 2014-03-18, Tokyo, Japan

Erlang Tracing: more than you wanted to know

Rough Outline

  • What can be traced?
  • How can trace events be specified?
  • "match specifications": twisty passages, all alike
  • WTF, can I just use DTrace and drink my coffee/beer/whisky in peace?
  • Trace delivery mechanisms: pick one of two
@andelf
andelf / dns_proxy_srv.erl
Last active December 16, 2015 09:18
erlang dns proxy, with long ttl and persistant etc table cache.
%%%-------------------------------------------------------------------
%%% @author <andelf@gmail.com>
%%% @copyright (C) 2013,
%%% @doc
%%%
%%% @end
%%% Created : 18 Apr 2013 by <andelf@gmail.com>
%%%-------------------------------------------------------------------
-module(dns_proxy_srv).
@seth
seth / Makefile
Created November 6, 2012 17:24
Template Makefile for Erlang projects
DEPS = $(CURDIR)/deps
DIALYZER_OPTS = -Wunderspecs
# List dependencies that should be included in a cached dialyzer PLT file.
# DIALYZER_DEPS = deps/app1/ebin \
# deps/app2/ebin
DEPS_PLT = {{name}}.plt
-module(shout).
-export([start/0]).
-import(lists, [map/2, reverse/1]).
-define(CHUNKSIZE, 24576).
start() ->
spawn(fun() ->
start_parallel_server(9000),
%% now go to sleep - otherwise the listening socket will be closed
@yongboy
yongboy / WhiteboardServer.java
Created May 23, 2012 01:48
在线画报socket.io服务器端示范
/**
* 在线画报socket.io服务器端示范
*
* @author yongboy
* @time 2012-3-27
* @version 1.0
*/
public class WhiteboardServer {
public static void main(String[] args) {
MainServer chatServer = new MainServer(new WhiteboardHandler(), 80);
@yongboy
yongboy / subCnString.java
Created March 14, 2011 07:07
字符串截取(设定中文长度为2)
/**
* 定义中文字符Unicode编码范围
*/
private static final String CN_PATTERN = "[\\u4e00-\\u9fbb]+";
public static final String subCnString(String str, int targetLen) {
if (str == null || str.equals(""))
return str;
if (targetLen < 1)