Skip to content

Instantly share code, notes, and snippets.

View hernandesbsousa's full-sized avatar

Hernandes Benevides de Sousa hernandesbsousa

View GitHub Profile
@hernandesbsousa
hernandesbsousa / postgres_queries_and_commands.sql
Created October 2, 2017 19:37 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
#! /bin/bash
#
# Dependencies:
# brew install jq
#
# Example:
# source aws-assume-role
# alias aws-assume-role="source aws-assume-role"
#
# Notes:
@hernandesbsousa
hernandesbsousa / multiple_ssh_setting.md
Created June 1, 2016 18:01 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@hernandesbsousa
hernandesbsousa / datadog-ruby-stats
Created April 22, 2016 17:14 — forked from mm53bar/Gemfile
Be sure to install the datadog agent on your server before applying this code to your app. Instructions are at https://app.datadoghq.com/account/settings#agent or use my Sunzi recipe at https://github.com/Shift81/sunzi-recipes/blob/master/ubuntu/precise/datadog.sh
gem 'dogstatsd-ruby'
@hernandesbsousa
hernandesbsousa / deploy_utils.rb
Created April 13, 2016 16:46 — forked from tsabat/deploy_utils.rb
A ruby script to get all instances with a given tags.
require 'aws-sdk'
require 'awesome_print'
class AwsUtil
def ec2_object
# deployer user, has read-only access
AWS::EC2.new(
access_key_id: "<your_key_here>",
secret_access_key: "<your_secret_here>",
@hernandesbsousa
hernandesbsousa / friday_deploy_cap2.rb
Last active August 28, 2015 20:49 — forked from exAspArk/friday_deploy_cap2.rb
Friday deploy script for Capistrano
# Capistrano 2
before "deploy", "friday:good_luck"
namespace :friday do
friday_jumper = %{
┓┏┓┏┓┃
┛┗┛┗┛┃⟍ ○⟋
┓┏┓┏┓┃ ∕ Friday
┛┗┛┗┛┃ノ)
@hernandesbsousa
hernandesbsousa / nginx-font-serving
Last active November 17, 2015 01:08 — forked from atiw003/nginx-font-serving
CORS setup for Nginx/Apache
For nginx,
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
Or better way inside virtual host location use,
Inside location use
if ($request_filename ~* ^.?/([^/]?)$)
@hernandesbsousa
hernandesbsousa / etc-nginx-nginx.conf
Created May 9, 2014 17:59 — forked from aaronfeng/etc-nginx-nginx.conf
Nginx logging in JSON format
# /etc/nginx/nginx.conf
log_format main '{'
'"remote_addr": "$remote_addr",'
'"remote_user": "$remote_user",'
'"time_local": "$time_local",'
'"request": "$request",'
'"status": "$status",'
'"body_bytes_sent": "$body_bytes_sent",'
'"http_referer": "$http_referer",'
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :serf do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>