Skip to content

Instantly share code, notes, and snippets.

View fdiasr's full-sized avatar

Fernando Dias fdiasr

View GitHub Profile
global
log 127.0.0.1 local1
maxconn 4096
#chroot /usr/share/haproxy
uid 99
gid 99
#debug
#quiet
defaults
docker stop upstream1
docker stop upstream2
docker rm upstream1
docker rm upstream2
docker run -d -p 5673:5672 -p 8081:15672 -h upstream1 --name upstream1 -e RABBITMQ_ERLANG_COOKIE='SJBDYCLARUGZFQFCDQQZ' rabbitmq:3-management
docker run -d -p 5674:5672 -p 8082:15672 -h upstream2 --name upstream2 -e RABBITMQ_ERLANG_COOKIE='SJBDYCLARUGZFQFCDQQZ' rabbitmq:3-management
docker exec upstream2 rabbitmqctl stop_app
docker exec upstream2 rabbitmqctl join_cluster rabbit@upstream1
@fdiasr
fdiasr / tips.sh
Last active May 6, 2016 21:42
Docker
# list only containers exited
docker ps -f "status=exited"
# remove containers with exited status
docker rm $(docker ps --filter "status=exited" -q)
# open bash when run docker container
docker run -ti python:2.7 bash
# open bash when run docker container and make a volume
@fdiasr
fdiasr / bobp-python.md
Last active September 9, 2015 18:25 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@fdiasr
fdiasr / gist:d97aa137d67262345c08
Created July 23, 2014 14:38
Unit Test with Mock - ensure my algorithm
<?php
class Myclass
{
private $baz;
public function foo($qux)
{
$fee = 10 * $qux; // algorithm
$this->getBaz()->bar($x);
@fdiasr
fdiasr / gist:688961cfd4be6f4c0b84
Last active August 29, 2015 14:01
grep with count lines
grep "string" filename | grep "string" | wc -l
@fdiasr
fdiasr / gist:3c67a35de6760cbb9b43
Created May 7, 2014 05:41
phalcon + fb api - check
http://docs.phalconphp.com/en/latest/index.html
https://developers.facebook.com/docs/php/gettingstarted/4.0.0
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/events/
Warning: Could not retrieve fact fqdn
Error: Evaluation Error: Illegal name. The given name Apache::Service does not conform to the naming rule /^((::)?[a-z_]w*)(::[a-z]w*)*$/ at /etc/puppet/modules/apache/manifests/init.pp:86:23 on node ingresse
Error: Evaluation Error: Illegal name. The given name Apache::Service does not conform to the naming rule /^((::)?[a-z_]w*)(::[a-z]w*)*$/ at /etc/puppet/modules/apache/manifests/init.pp:86:23 on node ingresse
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
FACTER_ssh_username='vagrant' puppet apply --verbose --hiera_config /vagrant/hiera.yaml --parser future --manifestdir /tmp/vagrant-puppet-1/manifests --detailed-exitcodes /tmp/vagrant-puppet-1/manifests/default.pp || [ $? -eq 2 ]

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

The gist

@fdiasr
fdiasr / acentuacao
Last active December 30, 2015 08:49
osx pt br
Agudo (É): Option + E + a letra desejada
C Cedilha (Ç): Option + C = Ç
Til (Ã): Option + N + a letra desejada = Ã , Õ
Circunflexo (Ê): Option + I + a letra desejada = Ê, Ô
Trema (Ü): Option + U + a letra desejada Ü