Skip to content

Instantly share code, notes, and snippets.

View seriyps's full-sized avatar

Sergey Prokhorov seriyps

View GitHub Profile
@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),
@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.
@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
@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
@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.
@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
@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())
.