Skip to content

Instantly share code, notes, and snippets.

@cooldaemon
cooldaemon / udp_server.erl
Created July 23, 2008 01:53
This is udp server framework for Erlang.
%% @author Masahito Ikuta <cooldaemon@gmail.com> [http://d.hatena.ne.jp/cooldaemon/]
%% @copyright Masahito Ikuta 2008
%% @doc UDP Server Behaviour.
%% Copyright 2008 Masahito Ikuta
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
@cooldaemon
cooldaemon / couchdb_btree_vs_dets.erl
Created July 23, 2008 10:05
CouchDB(btree) vs dets.
-module(couchdb_btree_vs_dets).
-author('cooldaemon@gmail.com').
-export([test/0, test/1]).
test() -> test(1000).
test(Count) ->
KVs = lists:map(
fun (N) -> {N, {foo, bar, baz}} end,
lists:seq(1, Count)
@cooldaemon
cooldaemon / edoc_test.erl
Created July 25, 2008 09:23
I'm practicing writing the EDoc.
%% @author Masahito Ikuta <cooldaemon@gmail.com> [http://d.hatena.ne.jp/cooldaemon/]
%% @copyright Masahito Ikuta 2008
%%
%% @doc The sample module for the EDoc.
%%
%% I'm practicing writing the EDoc.
%% This file was made because of the practice.
%%
%% Here's a quick example illustrating how to use edoc_test:
%% ```
@cooldaemon
cooldaemon / Portfile
Created July 27, 2008 09:59
This is local port file for erlang R12B-3.
PortSystem 1.0
name erlang
version R12B-3
revision 0
categories lang erlang
maintainers cooldaemon@gmail.com
platforms darwin
description The Erlang Programming Language
long_description \
Erlang is a programming language designed at the \
@cooldaemon
cooldaemon / call_code_change.erl
Created August 11, 2008 07:07
This files is test codes for the code_change function of gen_X modules.
-module(call_code_change).
-export([call_code_change/2, call_code_change/4]).
call_code_change(Name, OldVer) ->
call_code_change(Name, Name, OldVer, {}).
call_code_change(Pid, Module, OldVer, Extra) when is_pid(Pid) ->
sys:suspend(Pid),
sys:change_code(Pid, Module, OldVer, Extra),
sys:resume(Pid),
@cooldaemon
cooldaemon / lists_vs_func_vs_comp.erl
Created August 20, 2008 02:39
lists module vs func vs list comprehension.
-module(lists_vs_func_vs_comp).
-author('cooldaemon@gmail.com').
-export([test/0]).
test() ->
Seqs = lists:seq(0, 500000),
lists:foreach(
fun
({F, TargetName}) ->
@cooldaemon
cooldaemon / MochiPlus.js
Created August 25, 2008 10:14
Extended Mochikit.
var create_class = function () {
var m = MochiKit.Base;
var iter = MochiKit.Iter;
var new_func = function () {
if (typeof this._new !== 'function') {
return;
}
this._new.apply(this, arguments);
};
@cooldaemon
cooldaemon / README
Created August 26, 2008 09:11
parallel map on single node.
list_utils:pmap(fun (N) -> N * N end, lists:seq(1, 10)).
@cooldaemon
cooldaemon / Client.pm
Created September 14, 2008 10:01
Echo server made from Danga::Socket.
package Echo::Client;
use strict;
use warnings;
use IO::Socket::INET;
use Danga::Socket;
use Danga::Socket::Callback;
sub new {
@cooldaemon
cooldaemon / pmsetup
Created September 29, 2008 03:22 — forked from dann/gist:13374
#!/usr/bin/env perl
use strict;
use warnings;
use ExtUtils::MakeMaker qw(prompt);
use File::Basename;
use File::Path;
use File::Spec;
use Template;
use YAML;
use Config::Pit;