Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🐒

Diego Souza dgvncsz0f

💭
🐒
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am dgvncsz0f on github.
  • I am dgvncsz0f (https://keybase.io/dgvncsz0f) on keybase.
  • I have a public key ASDyQhQ0eOV4YhABAleIkAKnYNlW3fpBgg2WdFhfgG7UCAo

To claim this, I am signing this object:

View limit
#!/bin/sh
set -e
die () {
echo "$@"
exit 1
}
limit_memory () {
@dgvncsz0f
dgvncsz0f / yyy_controler.ex
Last active Sep 13, 2016
zipflow + erlcloud
View yyy_controler.ex
defmodule ErlCloud do
require Record
import Record, only: [defrecord: 2, extract: 2]
defrecord :aws_config, extract(:aws_config, from_lib: "erlcloud/include/erlcloud_aws.hrl")
end
defmodule Yyy.YyyController do
use Yyy.Web, :controller
View Test.java
import java.nio.ByteBuffer;
import java.util.*;
public class Test {
private static byte[] encode(int c, String path) throws Exception {
ByteBuffer buff = ByteBuffer.allocate(Integer.SIZE/8 + Character.SIZE/8 * path.length());
buff
.putInt(c)
.asCharBuffer()
View cache-pw
#!/usr/bin/expect -f
set spassword ""
set vpassword ""
set name "cache-pw"
set timeout 300
eval spawn -noecho [lrange $argv 0 [llength $argv]]
proc read_sudo_passwd {} {
global spassword
View y-elixir
defmodule Xerpa.Functions do
def fix(f) do
fn x ->
f.(fix(f), x)
end
end
end
@dgvncsz0f
dgvncsz0f / webleela-haproxy-servers
Created Jul 18, 2014
/usr/bin/webleela-haproxy-servers
View webleela-haproxy-servers
cat /usr/bin/webleela-haproxy-servers
#!/bin/sh
for ip in $(dig +tcp +short webleela.service.ita.consul.locaweb.com.br. | sort)
do
echo " server" $(echo -n ${ip} | sed s/\\./_/g) ${ip}:4080 maxconn 64 check
done
@dgvncsz0f
dgvncsz0f / consul.conf
Created Jul 18, 2014
dnsmasq.d/consul.conf
View consul.conf
server=/ita.consul.locaweb.com.br/10.30.124.165#8600
server=/ita.consul.locaweb.com.br/10.30.124.166#8600
server=/ita.consul.locaweb.com.br/10.30.124.167#8600
server=/ita.consul.locaweb.com.br/10.30.124.168#8600
server=/ita.consul.locaweb.com.br/10.30.124.169#8600
server=/ita.consul.locaweb.com.br/10.30.124.170#8600
@dgvncsz0f
dgvncsz0f / gist:5042947
Last active Dec 14, 2015
python devmakefile
View gist:5042947
# -*- mode: makefile-gmake; -*-
# variables you must define:
# project = ...
# srcroot = $(CURDIR)
# home_virtenv = ...
# rcfile = ...
# variables you should define
# env_pyenv = ...
@dgvncsz0f
dgvncsz0f / gist:4036204
Created Nov 8, 2012
tcp/ip socket options
View gist:4036204
// TCP window & socket buffers (DISABLES AUTOTUNE)
setsockopt(sock, SOL_TCP, TCP_WINDOW_CLAMP, &tmp, sizeof(tmp));
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, ...);
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, ...);
// 1/0
setsockopt(sock, SOL_TCP, TCP_CORK, ...);
// 1/0
setsockopt(sock, SOL_TCP, TCP_NODELAY, ...);