Random timelines with a bit a shadow.
This file contains hidden or 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
#!/usr/bin/env python | |
# coding: utf-8 | |
""" | |
Generic python script skeleton | |
""" | |
import sys, os, argparse, logging, ConfigParser | |
def parse_args(): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
%%! -hidden -setcookie cookie | |
-mode(compile). | |
main(["-?"]) -> | |
usage(); | |
main(Args) -> | |
case get_pid(Args) of |
This file contains hidden or 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
join([], _) -> []; %% or should it be <<"">> for a consistency sake? | |
join([H|[]], _) -> H; | |
join(List, Sep) when is_list(Sep) -> | |
join(List, list_to_binary(Sep)); | |
join([H|T], Sep) -> | |
join(T, H, Sep). | |
join([], Acc, _) -> | |
Acc; | |
join([H|T], Acc, Sep) -> |
This file contains hidden or 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
uuid() -> | |
<<A:32, B:16, C:16, D:16, E:48>> = crypto:rand_bytes(16), | |
Fmt = "~8.16.0b-~4.16.0b-4~3.16.0b-~4.16.0b-~12.16.0b", | |
Str = io_lib:format(Fmt, [A, B, C band 16#0fff, D band 16#3fff bor 16#8000, E]), | |
list_to_binary(Str). |
This file contains hidden or 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_to_timestamp() -> | |
now_to_timestamp(erlang:now()). | |
now_to_timestamp({Mega, Sec, _}) -> | |
Mega * 1000000 + Sec. | |
timestamp_to_now(TS) -> | |
{TS div 1000000, TS rem 1000000, 0}. |
This file contains hidden or 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
[{lager, [ | |
{handlers, [ | |
{lager_console_backend, [ | |
debug, | |
{lager_default_formatter, [time, " ", {module, | |
[module, {line, [":", line], ""}], ""}, " ", color, message, {eol, "\e[0m\r\n"}]} | |
]}, | |
{lager_file_backend, | |
[{file, "logs/console.log"}, {level, info}, {size, 10485760}, {date, "$D0"}, {count, 1}]}, | |
{lager_file_backend, |