This file contains 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
from boto.cloudfront import CloudFrontConnection | |
def update_default_root_object(searched_origin, aws_access_key_id, aws_secret_access_key, default_root_object='index.html'): | |
""" sets default_root_object of an aws cloud front distribution | |
for futher information checkout http://boto.s3.amazonaws.com/ref/cloudfront.html | |
or http://github.com/boto/boto/tree/master/boto/cloudfront | |
""" | |
connection = CloudFrontConnection(aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) |
This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'chef' | |
require 'chef/client' | |
require 'chef/run_context' | |
Chef::Config[:solo] = true | |
Chef::Config[:log_level] = :info | |
Chef::Log.level(:info) |
This file contains 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
#!/bin/bash | |
BACKUP_DIR='/backups/S3 Mirror/' | |
BUCKETS=$(s3cmd ls | grep s3 | awk '{ print $3 }') | |
for i in $BUCKETS; do | |
CURRENT_DIR=$BACKUP_DIR${i//s3:\/\//} | |
echo Mirroring $i to $CURRENT_DIR | |
mkdir -p "$CURRENT_DIR" | |
s3cmd sync $i "$CURRENT_DIR" |
This file contains 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
## | |
# @example | |
# ruby -rubygems `__FILE__` `source_bucket_name` `target_bucket_name` | |
# | |
# @author @ipoval | |
# | |
# @see https://github.com/ipoval |
This file contains 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
# Copy it to fnordmetric directory and run with | |
# bundle exec ruby -Ilib populate.rb live | |
require "securerandom" | |
require "socket" | |
require "json" | |
class User < Struct.new :username, :avatar | |
def session_id | |
"session_#{username}" |
This file contains 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
# i hope this helps... | |
# to set the username and picture send these events to fm | |
# -> you don't need to define any event handlers | |
# -> the session token (_session) could be your unique session id | |
# or the unique user id (it's hashed) | |
# set the user name | |
{ "_type": "_set_name", "name": "Tingle Tangle Bob", "_session": "mysessiontoken" } |
This file contains 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
#!/usr/bin/env python | |
from optparse import OptionParser | |
import boto.ec2 | |
import logging | |
import sys | |
def get_ec2_connection(aws_key=None, aws_secret=None, region='us-east-1'): | |
""" | |
Returns an EC2Connection to the specified region |
This file contains 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
#! /usr/bin/python | |
import threading, Queue | |
import boto, sys, time | |
import argparse | |
import logging | |
parser = argparse.ArgumentParser(description="Multithreaded mass copier for Amazon S3") | |
parser.add_argument("-s", help="Source bucket", dest="src_bucket", type=str, required=True) | |
parser.add_argument("-d", help="Destination bucket", dest="dst_bucket", type=str, required=True) |
This file contains 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
#!/usr/bin/python | |
# | |
# Get Cloudwatch metrics for the EBS volumes attached to an instance | |
# | |
import datetime | |
import logging | |
import sys | |
import urllib |
This file contains 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
#!/usr/bin/env ruby | |
# Add your gems here | |
# | |
gemfile_contents = <<-EOF | |
source "http://rubygems.org" | |
gem "fog" | |
gem "yajl-ruby" | |
EOF |
OlderNewer