This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo
channel from user nickname
.
$ python pub.py foo nickname
PUBLISH to channel #foo
#!/usr/bin/env escript | |
% -*- mode: erlang -*- | |
main([BeamFile]) -> | |
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
#!/usr/bin/env escript | |
-mode(compile). | |
epoch() -> | |
{Mega,Sec,Mili} = os:timestamp(), | |
(Mega * 1000000) + Sec + (Mili / 1000000). | |
measure(F) -> | |
Ini = epoch(), |
date_to_integer_iso8601({date,{Y,M,D}}) -> | |
datetime_to_integer_iso8601({datetime,{{Y,M,D},{0,0,0}}}). | |
datetime_to_integer_iso8601({datetime,{{Y,M,D},{H,Min,S}}}) -> | |
Y * 10000000000 + M * 100000000 + D * 1000000 + H * 10000 + Min * 100 + S. |
-module(atkin). | |
-export([primes_smaller_than/1]). | |
primes_smaller_than(Limit) -> | |
primes_smaller_than(Limit, sieve(Limit), []). | |
primes_smaller_than(0, _, Acc) -> | |
Acc; | |
primes_smaller_than(N, Bin, Acc) -> |
System -> Configuration -> General -> Currency Setup |
mysql> pager less -n -i -S |
To test how can works ephp I do a escriptize and you can use it to execute simple php code:
git clone https://github.com/bragful/ephp
cd ephp
make
All the time I was working with XMPP I realized this protocol has a lot of flaws to use in mobile devices, even the lack of sync for the messages between several devices. This protocol tries to solve those flaws:
% | |
Simple things should be simple, complex things should be possible. | |
The Wiki Way: Quick Collaboration on the Web, Bo Leuf, Ward | |
Cunningham | |
% | |
Simplicity is the soul of efficiency. | |
Austin Freeman | |
% | |
I have yet to see any problem, however complicated, which, when you | |
looked at it in the right way, did not become still more complicated. |