This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now = calendar:datetime_to_gregorian_seconds(erlang:universaltime()) - 14400, | |
DelFun = fun(File, {ok, [{{time, Time}, _}]}) when Time < Now -> file:delete(File); (_, _) -> ok end, | |
[DelFun(File, file:consult(File)) || File <- filelib:wildcard("cache/*")]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
div.row { | |
clear: both; | |
padding-top: 10px; | |
} | |
div.row span.label { | |
float: left; | |
width: 100px; | |
text-align: right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Str = "2008-10-01 10:00:01", | |
[YY, MM, DD, Hh, Mm, Ss] = [list_to_integer(X) || X <- string:tokens(Str, " -:")], | |
{{YY, MM, DD}, {Hh, Mm, Ss}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eshell V5.6.2 (abort with ^G) | |
1> c(sleeperl). | |
{ok,sleeperl} | |
2> sleeperl:testb(). | |
Receiver spawned at {1219,775147,552727} | |
Spawn start at {1219,775147,552864} | |
Spawn done at {1219,775147,553079} | |
ok | |
3> | |
receiver got '{done,<0.38.0>}' at {1219,775150,571689} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Copyright (c) 2008 Nick Gerakines <[email protected]> | |
%% | |
%% Permission is hereby granted, free of charge, to any person | |
%% obtaining a copy of this software and associated documentation | |
%% files (the "Software"), to deal in the Software without | |
%% restriction, including without limitation the rights to use, | |
%% copy, modify, merge, publish, distribute, sublicense, and/or sell | |
%% copies of the Software, and to permit persons to whom the | |
%% Software is furnished to do so, subject to the following | |
%% conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @doc A small LRU list container. | |
%% @todo Add better documentation. | |
%% @todo Find edge case bugs in purging. | |
-module(lrulist). | |
-author("Nick Gerakines <[email protected]>"). | |
-export([new/0, new/1, get/2, insert/3, remove/2, purge/1, keys/1]). | |
-define(EXPIRE_RULES, [expire, slidingexpire]). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(binlog). | |
-compile(export_all). | |
current_log() -> "db-000004.bin". | |
%% binlog:next_log(binlog:current_log()). | |
%% binlog:next_log("db-000004.bin"). | |
next_log("db-" ++ TmpA) -> | |
"nib." ++ TmpB = lists:reverse(TmpA), | |
TmpC = list_to_integer(lists:reverse(TmpB)) + 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backpack = { | |
setUser:function(val){ | |
Application.prefs.setValue("backpack_user", val); | |
}, | |
setDomain:function(val){ | |
Application.prefs.setValue("backpack_domain", val); | |
}, | |
setToken:function(val){ | |
Application.prefs.setValue("backpack_token", val); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(bottles). | |
-export([start/0, start/1, server_loop/1, take/0, info/0, stop/0]). | |
start() -> | |
start(99). | |
start(State) -> | |
Pid = spawn(bottles, server_loop, [State]), | |
pg2:create(bottles_server), | |
pg2:join(bottles_server, Pid), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module (mtdump). | |
-export([start/0]). | |
start() -> | |
mysql:start_link(mt, "localhost", "user", "password", "mt_database"), | |
mysql:prepare(posts, <<"SELECT entry_id, entry_basename, entry_text, entry_text_more, entry_created_on, entry_title FROM mt_entry where entry_blog_id = 3">>), | |
Posts = case mysql:execute(mt, posts, [], infinity) of | |
{data, MySQLRes} -> | |
Fields = [ F || {_, F, _, _} <- mysql:get_result_field_info(MySQLRes)], | |
Rows = mysql:get_result_rows(MySQLRes), |
OlderNewer