Skip to content

Instantly share code, notes, and snippets.

View seriyps's full-sized avatar

Sergey Prokhorov seriyps

View GitHub Profile
@zaphar
zaphar / date_util.erl
Created May 1, 2009 06:07
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
@cooldaemon
cooldaemon / Makefile
Created May 5, 2009 06:51
libxml2 sax sample.
xml2_sax_sample: xml2_sax_sample.c
gcc -o xml2_sax_sample `xml2-config --cflags --libs` xml2_sax_sample.c
clean:
rm xml2_sax_sample
@domenkozar
domenkozar / autovpn.py
Created January 1, 2012 16:00 — forked from anonymous/autovpn.py
AutoVPN for NetworkManager
#!/usr/bin/env python
"""
Copyright 2011 Domen Kozar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
@manpages
manpages / lambda_fields.py
Created July 19, 2012 11:38
Superpositional fields of lambda rays (icfpc-2012)
import logging
from world import World
from heapq import heappush, heappop
from test_emulators import run_interactively
class LambdaFields(object):
# fields: [(int LambdaCoordinate, [int] LambdaField)]
# list of individual fields produced by each lambda
# LambdaCoordinate is the 1d coordinate of lambda in the world
# LambdaField is the list of effects that the field has on each of the cells
@Aven02
Aven02 / Makefile
Created July 23, 2012 15:50 — forked from cooldaemon/Makefile
libxml2 sax sample.
xml2_sax_sample: xml2_sax_sample.c
gcc -o xml2_sax_sample `xml2-config --cflags --libs` xml2_sax_sample.c
clean:
rm xml2_sax_sample
@maxlapshin
maxlapshin / apache.erl
Created October 11, 2012 07:58
Script to check how many connections can Apache server survive
#!/usr/bin/env escript
-mode(compile).
-compile(export_all).
main([]) -> io:format("Usage: ~s URL [Count=1000]~n", [escript:script_name()]);
main([URL]) -> main([URL,"100"]);
main([URL,C] ) -> manage_workers(URL, [start_worker(URL, N) || N <- lists:seq(1,list_to_integer(C))]), ok.
@proger
proger / netstat.erl
Created November 22, 2012 16:39
netstat for erlang gen_tcp
-module(netstat).
-compile([export_all]).
-record(sock, {port, local, peer, stat, proc}).
retinfo({State, Term}) when is_atom(State) ->
Term.
sockinfo(Port, PortInfo) ->
Proc = proplists:get_value(connected, PortInfo),
@slfritchie
slfritchie / presentation.md
Created March 18, 2014 09:22
Erlang tracing, for the Riak source code reading series, 2014-03-18, Tokyo, Japan

Erlang Tracing: more than you wanted to know

Rough Outline

  • What can be traced?
  • How can trace events be specified?
  • "match specifications": twisty passages, all alike
  • WTF, can I just use DTrace and drink my coffee/beer/whisky in peace?
  • Trace delivery mechanisms: pick one of two
@LeebDeveloper
LeebDeveloper / niftest.erl
Created June 30, 2014 15:25
Erlang NIF in pure Rust
-module(niftest).
-export([add/2]).
-on_load(init/0).
init() ->
ok = erlang:load_nif("./nif", 0).
add(_, _) ->
exit(nif_library_not_loaded).
@tsloughter
tsloughter / erl_nif.rs
Created September 28, 2014 02:18
Erlang Nif Rust Bindings
/* automatically generated by rust-bindgen */
pub type ErlNifUInt64 = ::libc::c_ulong;
pub type ErlNifSInt64 = ::libc::c_long;
pub type ERL_NIF_TERM = ::libc::c_ulong;
pub type ERL_NIF_UINT = ERL_NIF_TERM;
pub enum Struct_enif_environment_t { }
pub type ErlNifEnv = Struct_enif_environment_t;
#[repr(C)]
pub struct ErlNifFunc {