Skip to content

Instantly share code, notes, and snippets.

View marcelog's full-sized avatar

Marcelo Gornstein marcelog

View GitHub Profile
@marcelog
marcelog / webrtc2sip_optional_console.diff
Last active August 27, 2015 16:12
This is a patch to add an argument to webrtc2sip to optionally disable the console. After patching, recompile and start it with the argument --without-console
Index: mp_mediaproxy.cc
===================================================================
--- mp_mediaproxy.cc (revision 141)
+++ mp_mediaproxy.cc (working copy)
@@ -21,6 +21,7 @@
#include <libxml/tree.h>
+static int with_console = 1;
static char* sConfigXmlPath = NULL;
@marcelog
marcelog / ls.mxs
Created October 29, 2012 01:04
poor (very) man's ls in elixir
#!/usr/bin/env elixir
files = File.wildcard(hd(System.argv()) <> "/*")
Enum.each files, fn(x) -> IO.puts x end
@marcelog
marcelog / gist:4063103
Created November 13, 2012 00:41
Multiple ami connections with nami (nodejs asterisk manager interface)
// Used to store different nami objects (dont worry about it)
var namis = [];
// Create your event emitter object, you will call "on()"
// on this one instead of "the namis".
var mainEventEmitter = ....;
// Assuming you have an array called "boxes" with the ami
// login info for each "ami box", and a "name" field.
for(var j = 0; j < boxes.length; j++) {
@marcelog
marcelog / generic_proxy.js
Last active December 17, 2015 01:10
Quick and small tcp proxy written in nodejs. Opens a socket and listens for incoming connections. For every new incoming connection, it will open a connection to the proxied host, and send whatever it gets from either side to the other.
#!/usr/bin/env node
var port_to = 6379;
var port_from = 63790;
var net = require('net');
var server = net.createServer(function(clientSocket) {
var targetSocket = net.connect({port: port_to});
targetSocket.on('data', function(data) {
clientSocket.write(data);
@marcelog
marcelog / main.cf
Created May 8, 2016 14:14
Part of: http://marcelog.github.io/articles/configure_postfix_forward_email_regex_subject_transport_relay.html setting up the postfix main.cf file so we can check the email headers and take actions accordingly
header_checks = regexp:/etc/postfix/header_checks
#!/bin/bash
postmap hash:/etc/postfix/header_checks
postfix reload
@marcelog
marcelog / main.cf
Created May 8, 2016 14:30
Part of: http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html Using postfix to route all local emails to an external SMTP gateway
transport_maps = hash:/etc/postfix/transport
@marcelog
marcelog / transport
Created May 8, 2016 14:31
Part of http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html setting up the Postfix transport file to route (forward) all emails to an external SMTP gateway
* smtp:myotherhost.com
@marcelog
marcelog / reload_postfix_transport.sh
Created May 8, 2016 14:32
Part of: http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html Reloading postfix so it will pick up the changes in the transport file
#!/bin/bash
postmap hash:/etc/postfix/transport
postfix reload
@marcelog
marcelog / build-php-5.2.sh
Created May 8, 2016 14:41
Part of: http://marcelog.github.io/articles/configure_nginx_php_5.3_5.2_fastcgi.html How to build PHP 5.2 so it can be used through FastCGI
./configure --enable-fastcgi --with-pcre --enable-mbstr-enc-trans --enable-mbstring