Skip to content

Instantly share code, notes, and snippets.

-module(web_lager_handler).
-behaviour(gen_event).
-export([subscribe/1, unsubscribe/1]).
-export([init/1, handle_call/2, handle_event/2, handle_info/2, terminate/2,
code_change/3]).
-export([remover_loop/0]).
#!/usr/bin/env escript
%%
%%! -name hanoi@127.0.0.1 -pa ebin -env ERL_LIBS apps:deps
-mode(compile).
main([]) ->
{ok, _} = hanoidb:open_link({local,db},"db", [{compress, gzip},{sync_strategy,{seconds,86400}}]),
put(start_at, erlang:now()),
loop(0).
@maxlapshin
maxlapshin / auth.php
Last active August 29, 2015 14:02
auth.php
<?php
$get = print_r($_GET, true);
$token = $_GET["token"];
if(!$token || !strlen($token)) {
header('HTTP/1.0 403 Forbidden');
error_log("No token provided", 4);
die();
<?php
if(preg_match('/auth.php/', $_SERVER["REQUEST_URI"])) {
error_log("Auth request: ".print_r($_GET,true));
header("HTTP/1.0 200 OK");
header("X-Userid: ".$_GET["token"]);
header("X-Unique: true");
exit(0);
}
#include <stdint.h>
#include "erl_nif.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#include <Carbon/Carbon.h> // Oh noes! See discussion blow at GetCurrentProcess
2015-02-04 18:33:03 =ERROR REPORT====
OS_MON (memsup) timeout, no data collected
2015-02-04 18:33:03 =ERROR REPORT====
** Generic server memsup terminating
** Last message in was {collected_ext_sys,[{system_total_memory,12590178304},{free_swap,0},{total_swap,0},{cached_memory,422768640},{buffered_memory,3723264},{free_memory,230199296},{total_memory,12590178304}]}
** When Server state == [{data,[{"Timeout",60000000}]},{items,{"Memory Usage",[{"Allocated",12416077824},{"Total",12590178304}]}},{items,{"Worst Memory User",[{"Pid",<0.66.0>},{"Memory",1115016}]}}]
** Reason for termination ==
** {badarg,[{erlang,cancel_timer,[undefined],[]},{memsup,handle_info,2,[{file,"memsup.erl"},{line,471}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,599}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
2015-02-04 18:33:03 =CRASH REPORT====
crasher:
#!/bin/bash
ERLANG=17.4
SQLITE=amalgamation-3071700
cd /root
[ -f /usr/bin/gcc ] || (apt-get update && apt-get install -y build-essential)
[ -f /usr/bin/chrpath ] || apt-get -y install chrpath
#!/usr/bin/env escript
%! -env ERL_LIBS deps -pa deps/io_libc/ebin
-mode(compile).
main([]) ->
code:add_pathz("deps/io_libc/ebin"),
Time = {{2015,3,21},{17,30,57}},
Count = 100000,
-module(map_test1).
-export([main/0]).
-record (r1, {map_data, a = 0}).
main() ->
R1 = #r1{map_data = #{count => 1}},
io:format("Created: ~p~n", [R1]),
R2 = modify(R1),
io:format("Modified: ~p~n", [R2]).
#define __USE_GNU
#define _GNU_SOURCE
#include <pthread.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "erl_nif.h"
#include "frog_draw.h"