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 / supervisor.conf
Created May 4, 2016 17:31
Supervisor generic config with 2 workers
[program:app-sidekiq]
directory=/apps/my_app/current
command=/apps/my_app/current/bin/run bin/sidekiq -c 15
stopsignal=QUIT
stderr_logfile=/apps/my_app/current/log/sidekiq_err.log
stdout_logfile=/apps/my_app/current/log/sidekiq_out.log
user=app_user
[program:background_job]
directory=/apps/my_app/current
@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 / pretty_print.rb
Created January 19, 2016 02:33
Using Ruby's pretty print
require "pp"
pp hash
@hernandesbsousa
hernandesbsousa / converting_pfx_to_pem.md
Last active January 8, 2016 16:55
Extract private key and certificate from PKCS12 file
@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 / route_table_modifier.py
Last active August 29, 2015 14:08
Route Table Assigner for AWS Nat instances
#!/bin/env python
# This script should run at boot (set as user data) on NAT instances
# - Disables the source/dest check for the current instance
# - Modifies default route for the specified route table to the instance running this
import argparse
import boto
import boto.utils
language: python
build_environment: debian wheezy
reset_minion: true
python:
- 2.7
install:
@hernandesbsousa
hernandesbsousa / ec2_playbook.yml
Created July 22, 2014 17:21
Issue with instance tags on ec2 module
vars:
key_name: mykey
instance_type: t2.micro
security_group: sg-xxxxxxxx
image: ami-f5b815e8
region: sa-east-1
subnet_id: subnet-5eaxxxxx
instance_tags:
- '{"foo": "bar"}'