Skip to content

Instantly share code, notes, and snippets.

View rsampaio's full-sized avatar

Rodrigo Sampaio Vaz rsampaio

View GitHub Profile
@rsampaio
rsampaio / Dockerfile
Created December 21, 2015 11:16
Dockerfile Elixir phoenix
FROM alpine
RUN echo 'http://dl-4.alpinelinux.org/alpine/edge/main' > /etc/apk/repositories && \
echo 'http://dl-4.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
apk add --update elixir gettext-dev erlang-crypto nodejs && \
rm -rf /var/cache/apk
RUN adduser -D -h /app app
USER app
@rsampaio
rsampaio / ed.lua
Last active August 29, 2015 14:14
#!/usr/bin/env lua
--
http = require("socket.http")
string = require("string")
ltn12 = require ("ltn12")
function encodetable(table)
local str = ""
@rsampaio
rsampaio / collectd.py
Created March 20, 2013 15:53
collectd protocol python script
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim: fileencoding=utf-8
#
# Copyright © 2009 Adrian Perez <[email protected]>
#
# Distributed under terms of the GPLv2 license.
"""
Collectd network protocol implementation.
@rsampaio
rsampaio / dhcp_server.py
Created March 2, 2012 21:20 — forked from robertondc/dhcp_server.py
dhcp_server.py
from pydhcplib.dhcp_packet import *
from pydhcplib.dhcp_network import *
import threadpool
netopt = { "client_listen_port": "68",
"iface": "eth0",
"server_listen_port": "67",
"listen_address": "0.0.0.0"
}
@rsampaio
rsampaio / erbot.erl
Created February 13, 2012 23:07
erbot
#!/usr/bin/env escript
-module(erbot).
-export([start/0]).
-define(_SERVER, "irc.oftc.net").
-define(_NICK, "4funBot").
-define(_CHANNEL, "#sysadms").
start() ->
{ok, Socket} = gen_tcp:connect(?_SERVER, 5222, [binary, {packet, 0}]),
@rsampaio
rsampaio / redisconfig.py
Created June 19, 2011 07:23
Redis backend for RawConfigParser
import redis
from ConfigParser import RawConfigParser, NoSectionError
class RedisConfigParser(RawConfigParser):
def __init__(self, defaults):
self.redis = redis.Redis(defaults['redis'])
self.redis.select(1)
self.namespace = defaults['namespace']
@rsampaio
rsampaio / liar.c
Created December 23, 2010 05:30
facebook puzzle - fun with dynamic memory and bigraphs
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/errno.h>
#define MAX_LINE 1024
typedef struct group {
char name[MAX_LINE];