This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |