Skip to content

Instantly share code, notes, and snippets.

View aussielunix's full-sized avatar
🤠
G`Day

Mick Pollard aussielunix

🤠
G`Day
View GitHub Profile
require 'aws/s3' # gem name is 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = :public_read
# from_credentials and to_credentials are both hashes with these keys:
# * :aws_access_key_id
@aussielunix
aussielunix / README.md
Last active December 27, 2015 03:39
configurable logging using the yell rubygem.

ruby logging

  • Global logger with yell config that is read in from a yaml file.
  • This allows end users to configure logging to their own needs.
  • new adapters etc can be add including a GELF adapter.
  • yell will read and honour RAILS_ENV, RACK_ENV or YELL_ENV and defaults to development

Goals

As a developer I would love to have at my disposal, via the way of a mixin, an easy way to log things without having to understand how.

@aussielunix
aussielunix / precise64.ks
Last active May 3, 2021 05:48
Ubuntu Precise amd64 kickstart with working LVM
#System language
lang en_AU
#Language modules to install
langsupport en_AU
#System keyboard
keyboard us
#System mouse
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
echo "in git pre-commit hook"
# Setup variables
BUNDLE_PATH=$JENKINS_HOME/jobs/$JOB_NAME/shared/bundle
# Setup dependencies
mkdir -p $BUNDLE_PATH
bundle install --path=$BUNDLE_PATH
bundle exec fpm-cook
@aussielunix
aussielunix / git-fixup-email.sh
Created May 3, 2013 11:46
git: change commit details
#!/bin/sh
git filter-branch -f --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "otter@example.com" ]
@aussielunix
aussielunix / fog_vsphere_clone_vm.rb
Created April 1, 2013 08:28
fog_vsphere_clone_vm.rb
#!/usr/bin/env ruby
require 'fog'
require 'pp'
connection = Fog::Compute[:vsphere]
puts "Connected to #{connection.vsphere_server} as #{connection.vsphere_username} (API version #{connection.vsphere_rev})"
options = {
:datacenter => 'syd07',
#!/usr/bin/env ruby
require 'rubygems'
require 'pp'
require 'fog'
require 'highline/import'
def get_password(prompt="Enter password:")
ask(prompt) {|q| q.echo = false}
end
#!/usr/bin/env bash
if [ $(/sbin/iptables -L INPUT | wc -l) -le 3 ]; then
exit 1
else
exit 0
fi
@aussielunix
aussielunix / cap_cli.rb
Last active December 14, 2015 04:09
consuming cap tasks from ruby proper
require 'capistrano/cli'
config = ::Capistrano::Configuration.new
# This loads up the tasks into the current scope
#
config.load 'tasks/foo.rb'
# run task 'foo'
#