Skip to content

Instantly share code, notes, and snippets.

View copernicus's full-sized avatar

Nicolaus Copernicus copernicus

View GitHub Profile
#!/usr/bin/env python
import boto
from boto.sqs.message import RawMessage
import tempfile
import json
import logging
import argparse
import gzip
import redis
# gem install aws-sdk
require 'aws'
PRICE_PER_GB_MONTH = 0.11
ACCESS_KEY = '...'
SECRET_KEY = '...'
ENDPOINT = 'eu-west-1.ec2.amazonaws.com'
@copernicus
copernicus / aws.rb
Created February 6, 2013 13:05 — forked from cwgem/aws.rb
def describe_pvgrub_images()
headers = ["Image ID", "Name", "Description", "Architecture", "Kernel ID"]
values = []
AWS.memoize do
@ec2.images.with_owner('amazon').filter('name', '*grub*').each do | i |
values << [i.id, i.name, i.description, i.architecture, i.kernel_id]
end
end
@copernicus
copernicus / Gemfile
Created November 19, 2012 14:11 — forked from SeanJA/Gemfile
pageviews widget for dashing
gem 'garb', :git => 'git://github.com/Sija/garb.git'
@copernicus
copernicus / ec2-metadata
Created April 20, 2012 13:00 — forked from yaronf/ec2-metadata
ec2-metadata: a simple tool for exploring Amazon EC2 metadata, extended with network and VPC info
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
@copernicus
copernicus / backup_sdb.rb
Created March 21, 2012 21:05 — forked from wr0ngway/backup_sdb.rb
script to backup all simpledb tables from a given aws account
#!/usr/bin/env ruby
# Add your gems here
#
gemfile_contents = <<-EOF
source "http://rubygems.org"
gem "fog"
gem "yajl-ruby"
EOF
@copernicus
copernicus / ebs_stats.py
Created February 16, 2012 14:16 — forked from beaufour/ebs_stats.py
Get CloudWatch metrics for Amazon EBS volumes
#!/usr/bin/python
#
# Get Cloudwatch metrics for the EBS volumes attached to an instance
#
import datetime
import logging
import sys
import urllib
@copernicus
copernicus / s3_multicopy.py
Created February 12, 2012 13:44 — forked from nukemberg/s3_multicopy.py
s3 multithreaded bucket copy
#! /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)
@copernicus
copernicus / gist:1808625
Created February 12, 2012 13:42 — forked from ehazlett/gist:1754289
AWS EBS Volume Cleanup
#!/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
@copernicus
copernicus / gist:1663171
Created January 23, 2012 13:41 — forked from asmuth/gist:1557137
FnordMetric: setting user picture/name and unique gauges
# 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" }