Skip to content

Instantly share code, notes, and snippets.

View eduardodeoh's full-sized avatar
🏠
Working from home

Eduardo de Oliveira Hernandes eduardodeoh

🏠
Working from home
  • São José do Rio Preto / SP / Brasil
View GitHub Profile
@eduardodeoh
eduardodeoh / gist:3964742
Created October 27, 2012 14:04 — forked from chalmerj/gist:1492384
Init script for Graphite carbon-cache
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@eduardodeoh
eduardodeoh / send_metric_to_statsd.sh
Created November 1, 2012 19:37 — forked from nstielau/send_metric_to_statsd.sh
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.

Contrato Arrasador 3

Revisão: 02/05/2013

Entre nós [nome nossa empresa] e você [nome cliente]

Sumário:

Nós sempre faremos o melhor para cumprir suas necessidades e atender suas expectativas, mas é importante registrar tudo por escrito para que todos saibam quem deve fazer o quê e quando, e o que acontece quando algo der errado. Neste contrato você não encontrará nenhum termo jurídico complicado ou longas passagens de textos incompreensíveis. Não temos interesse em fazê-lo assinar algo que poderá se arrepender depois. O que queremos é o melhor para ambas as partes, agora e no futuro!

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

#!/bin/sh
# Locale
echo "Changing locale"
sudo apt-get -y install language-pack-pt
clear
# System update
echo "Updating repositories"
sudo apt-get -y update
@eduardodeoh
eduardodeoh / 0_reuse_code.js
Created October 1, 2013 01:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# include from an initializer
module HstoreAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def hstore_accessor(hstore_attribute, *keys)
Array(keys).flatten.each do |key|
#!/usr/bin/env ruby
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'
)
ActiveRecord::Schema.define do
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
#!/bin/sh
#
## This is called to back up the WAL files to the slave.
## This is on top of replication and is used as another
## method to secure data successfully transferring from one
## database server to another.
ARCHIVE_DIR_ON_SLAVE="/var/lib/postgresql/walfiles"
LOG=1
LOG_FILE="/tmp/postgres_wal_archiving.log"