Skip to content

Instantly share code, notes, and snippets.

View greggy's full-sized avatar

Grigory Fateyev (aka greg) greggy

View GitHub Profile
if (data.result == 'ok'){
for (var i = 0; i < self.type_results().length; i++) {
var el = self.type_results()[i];
if (el.id == id) {
self.type_results.remove(el);
el.approved = true;
self.type_results.splice(i, 0, el);
break; // we found our id so can break the loop
}
}
DEBUG: Worker compilation failed: [{error,
{'EXIT',
{undef,
[{leex,file,
["src/protobuffs_scanner.xrl",
[{scannerfile,
"src/protobuffs_scanner.erl"},
{return,true}]],
[]},
{rebar_erlc_compiler,compile_xrl_yrl,
@greggy
greggy / gist:1a65c83ed2828e24ac0e
Created January 31, 2015 15:04
Get timestamp with TZ
###########################################
## Get timestamp with TZ
###########################################
from datetime import datetime
import time, pytz
mytz = pytz.timezone('Europe/Moscow')
print( int(time.mktime(mytz.localize(datetime.now()).timetuple())) )
start_link() ->
Pid = spawn_link(fun() -> start_server() end),
{ok, Pid}.
start_server() ->
mnesia:start(),
loop().
loop() ->
diff --git a/README.txt b/README.txt
index 8ac5719..136cf76 100644
--- a/README.txt
+++ b/README.txt
@@ -19,6 +19,17 @@ Run the appropriate script:
This script will compile the .erl files in the Misultin src directory and save the compiled files into the
ebin directory.
+ 1.1 Dependents
+
count_viewers() ->
[
[lists:flatten(io_lib:format("Node: ~p, Channel: ~p, Viewers: ~p",
[Node, ChannelId,
case rpc:call(Node, proxy, count_viewers, [ChannelId]) of
{badrpc, _} -> "Not proxy";
Res -> Res
end
]))
|| ChannelId <- utils:get_sessions_id(global:registered_names())]
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
start_proxy(SessionPid, ChannelID) ->
Name = list_to_atom(ChannelID),
supervisor:terminate_child(proxy_sup, Name),
supervisor:delete_child(proxy_sup, Name),
SpecProxy = {Name, {proxy, start_link, [SessionPid, ChannelID, Name]},
transient, 2000, worker, [Name]},
case supervisor:start_child(?SERVER, SpecProxy) of
(proxy@silver_proxy.stream.lan)1> proxy_sup:start_proxy(122, 211).
2011-12-08 13:46:54:344798 proxy:88:debug [<0.87.0>]->[init_start]: Start proxy: 211
2011-12-08 13:46:54:348767 proxy_gw:79:debug [<0.88.0>]->[]: Start proxy gw
2011-12-08 13:46:54:350000 =PROGRESS REPORT=======
supervisor: {local,proxy_sup}
started: [{pid,<0.87.0>},
{name,'RTMPProxy_211'},
{mfargs,{proxy,start_link,[122,211,'RTMPProxy_211']}},
{restart_type,transient},
{shutdown,2000},
> pgsql:equery(C2, "INSERT INTO app_test (test1, test2, test3) VALUES ($1, $2, $3) RETURNING id", ["TEST1", 127, pgsql_binary:encode(timestamptz, {{2012,7,2},{17,12,10}})]).
** exception exit: {noproc,{gen_fsm,sync_send_event,
[<0.3800.0>,
{parse,[],
"INSERT INTO app_test (test1, test2, test3) VALUES ($1, $2, $3) RETURNING id",
[]},
infinity]}}
in function gen_fsm:sync_send_event/3 (gen_fsm.erl, line 214)
in call from pgsql:equery/3 (src/pgsql.erl, line 44)
function sumup_time(t1, t2){
if (t2.split(':').length == 2){
t2 = '00:'+t2;
}
var d1 = new Date(0);
var d2 = new Date(0);
if (parse_time(t1).hh != '00'){
d1.setHours(parse_time(t1).hh);
} else {