Skip to content

Instantly share code, notes, and snippets.

View benhawker's full-sized avatar

Ben Hawker benhawker

View GitHub Profile
@edwardsharp
edwardsharp / bucket_sync_service.rb
Created May 10, 2016 23:18
ruby class to copy from one aws s3 bucket to another based on bantic/bucket_sync_service.rb
require 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = "public-read"
def initialize(from_bucket, to_bucket)
@giwa
giwa / file0.txt
Last active March 27, 2020 11:31
Install hive on Mac with Homebrew ref: http://qiita.com/giwa/items/dabf0bb21ae242532423
$ brew update
$ brew install hive
@mryoshio
mryoshio / batcth_write_dynamodb.rb
Created September 28, 2013 16:56
sample ruby script to batch write onto DynamoDB
require 'aws'
require 'aws-sdk'
ACCESS_KEY_ID='access key'
SECRET_ACCESS_KEY='secret access key'
TABLE='table name'
MAX_ITEMS=100
AWS.config({
access_key_id: ACCESS_KEY_ID,
@stevenharman
stevenharman / faraday-request-xml.rb
Created August 20, 2013 23:46
An example of a Request middleware to send the body as XML
module FaradayMiddleware
class XmlRequest < Faraday::Middleware
dependency do
require 'active_support/all'
end
def call(env)
if env[:method] == :post
body = env[:body]
first_key = body.keys.first
@ujuettner
ujuettner / gist:3914147
Created October 18, 2012 19:09
Just a small sample on how to deal with DynamoDB and Ruby using the AWS SDK for Ruby
#!/usr/bin/env ruby
#
file_location = File.dirname(__FILE__)
$:.unshift(File.join(file_location, 'aws-sdk-for-ruby', 'lib'))
require 'yaml'
require 'aws-sdk'
require 'Date'
aws_config_file = File.join(File.dirname(__FILE__), 'aws_config.yml')
#!/usr/bin/ruby
require 'rubygems'
require 'gruff'
# Let's hack almost everything
g = Gruff::Bar.new('800x700') # Define a custom size
g.sort = false # Do NOT sort data based on values
g.maximum_value = 40 # Declare a max value for the Y axis