Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@jareware
jareware / s3-curl-backups.md
Last active May 11, 2024 23:39
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@SteveMarshall
SteveMarshall / gist:1f2d733f2cb8dda330bc
Last active August 29, 2015 14:17
Scale Summit 2015 What's Changed Since Last Year: things and non-things
Notes of Scale Summit 2015 what's changed since last year.
Things last year:
- “Big Data is a thing”; Big Data is now pointless
- “Is CouchDB dead?” npm were? Fairly sure couchdb is now dead, despite more funding
- Under still going: Mongo, Riak. Mongo's not dead? Guardian, GDS, MOJ. Mongo on the rise again? Mongo *might* be dead; we don't know.
- Websockets were "standard" but weren't really… except for certain browsers, proxies, etc.
- HTML5 video still doesn't really work
- Flash is still dying… Unless you count CVEs. Lots of flash-based ads.
- WebGL has taken hold? Still true, apparently.
@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
create_resources("mail::domain", $domains)
["update-puppet.sh", "run-puppet.sh"].each |$file| {
file{"/usr/local/bin/${file}":
owner => "root",
group => "root",
mode => "0700",
source => "puppet:///modules/puppet/${file}"
}
}
@voxxit
voxxit / download-slow-query-log.sh
Last active October 31, 2023 16:13
Downloads RDS slow query logs for the last 24 hours using the AWS CLI
#!/bin/bash
instanceID=$1
date=$(date +%Y%m%d)
function downloadLog () {
local log=$1
aws rds download-db-log-file-portion \
--output text \
@gene1wood
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active November 9, 2022 16:40
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])