Skip to content

Instantly share code, notes, and snippets.

View zitooon's full-sized avatar

Olivier de Robert zitooon

  • Octoly
  • Montpellier
View GitHub Profile
@zitooon
zitooon / Nginx SSL
Created February 12, 2016 15:12 — forked from fabien7337/Nginx SSL
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
sudo service nginx stop
cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone -d example.com -d www.example.com
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
@zitooon
zitooon / emr.rake
Last active August 29, 2015 14:03
Amazon AWS EMR rake tasks for automated cluster creation (using Hadoop, Hive and Sqoop), easily editable
namespace :aws do
namespace :emr do
def emr_cluster_base_options(opts={})
opts = { keep_job_flow_alive_when_no_steps: false }.merge(opts)
base_options = {
ami_version: 'latest',
log_uri: 's3n://your/bucket/logs/dir/',
instances: {
instance_groups: [
@zitooon
zitooon / s3_utils.rb
Last active August 29, 2015 14:00
AWS S3 useful methods to upload/download/delete and check existing files recursively
# OVERWRITE_AWS_CONFIG is used to create a s3 client which use production environment when using methods in development
require 'fileutils'
module S3Utils
def self.files_exists_in?(dir_name)
bucket = AWS::S3.new(OVERWRITE_AWS_CONFIG).buckets[APP_CONF[:s3][:bucket]]
bucket.as_tree(prefix: "#{dir_name}").children.each do |obj|
if obj.branch?
@zitooon
zitooon / aws_dynamodb.rake
Last active August 29, 2015 14:00
Dynamodb throughput scaling rake task
# OVERWRITE_AWS_CONFIG is used to create a dynamo_db client which use production environment when using rake task in development
namespace :aws do
namespace :dynamodb do
desc "DynamoDB scale by table_name"
task :scale, [:table_name, :read, :write] => :environment do |t, args|
args.with_defaults(read: 1200, write: 1200)
requested_read = args[:read].to_i
requested_write = args[:write].to_i
@zitooon
zitooon / aws_autoscale.rake
Created April 29, 2014 05:57
AWS autoscale management rake tasks
namespace :aws do
namespace :autoscale do
require 'shellwords'
def title_puts s
puts "\n############################## #{s} ##############################"
end
def define_default_variables!
@autoscale_group_name = "your-autoscale-group-name-here"
# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
#
# Andre Lewis 1/2010
# encoding: utf-8