Skip to content

Instantly share code, notes, and snippets.

View systra's full-sized avatar

Andrzej Trawiński systra

  • jTendo
  • Warsaw, Poland
View GitHub Profile
@systra
systra / opts_utils.erl
Created November 24, 2011 10:22
Options merge
-module(opts_utils).
-export([merge_opts/2]).
%% Sample use:
%% Defaults = [{host,"localhost"},
%% {password, []},
%% {port,5432},
%% {password,[]},
%% {username,"test"},
@systra
systra / build.conf
Created June 11, 2013 05:45
Seagull build configuration file for OS X (Darwin). Tested on 10.8.4. Disabled support for TCAP, SCTP, CRYPTO, TLS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
@systra
systra / graphite.md
Created September 20, 2013 11:58 — forked from caged/graphite.md

This is a general overview (from memory) of the steps I used to install graphite (http://graphite.wikidot.com) on OS X Lion. I think the steps are in order but YMMV. Please fork and fix if you find an error.

Install Python 2.7.2

brew install python

Check your env

$ python --version
#!/bin/bash
# How to install Graphite as a user on CentOS 5.5 (with neither internet access and root account)
# --------------------------------------------------------------------------------
# Tomasz Kalkosiński - refaktor.blogspot.com
#
# Graphite is a Scalable Realtime Graphing (http://graphite.wikidot.com/)
# This script is based on two excellent tutorials:
# http://community.webfaction.com/questions/10038/how-to-install-pycairo-in-python27-thanks
@systra
systra / dbcleanup.sh
Created December 8, 2013 21:35
CouchDB cleanup - remove old documents (shell method)
#!/bin/bash
# source: http://bravenewmethod.com/2012/05/31/couchdb-cleanup-script-for-purging-old-docs/
# but modified to get rid of node.js dependency
# if database needs auth:
# DBHOST=user:pass@hostname
DBHOST=localhost
PORT=5984
@systra
systra / snow.rb
Created December 18, 2013 08:09
OSX: "Let it snow" in the terminal
ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'
@systra
systra / gist:a8b954732f6c80edfd8f
Created June 18, 2014 14:25
record to proplist
R = #record{}.
lists:zip(record_info(fields, record), tl(tuple_to_list(R))).
@systra
systra / gist:ee8b65a91cf51693ffad
Created June 24, 2014 06:34
beam permissions
sudo setcap cap_net_bind_service+ep ./erts-5.9.2/bin/beam
sudo setcap cap_net_bind_service+ep ./erts-5.9.2/bin/beam.smp
@systra
systra / gist:c4d7aad06da310a39cd4
Last active August 29, 2015 14:07
freeswitch compilation errors - solutions (OS X Mavericks 10.9)
$ ./configure --enable-shared --enable-static --with-erlang --prefix=/opt/freeswitch --exec_prefix=/opt/freeswitch
...
setting PLATFORM_CORE_LDFLAGS to "--framework CoreFoundation"
setting PLATFORM_CORE_LIBS to "-ldl"
checking for inflateReset in -lz... no
configure: error: no usable zlib; please install zlib devel package or equivalent
FIX:
@systra
systra / udp_test.erl
Created January 2, 2015 10:43
Shared UDP socket gen_server
-module(udp_test).
-behaviour(gen_server).
-define(SERVER, ?MODULE).
-define(PORT, 9876).
-define(TIMEOUT, 10).
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------