Skip to content

Instantly share code, notes, and snippets.

View mdkent's full-sized avatar

Matthew Kent mdkent

  • Basecamp
  • Nanaimo, BC, Canada
View GitHub Profile
@mdkent
mdkent / iam-terraform-create-policy.tf
Created June 28, 2022 21:03 — forked from arsdehnel/iam-terraform-create-policy.tf
AWS IAM policies for running Terraform from an EC2 instance.
resource "aws_iam_policy" "terraform_create_policy" {
name = "terraform_create_policy"
path = "/"
policy = "${data.aws_iam_policy_document.terraform_create_policy.json}"
}
data "aws_iam_policy_document" "terraform_create_policy" {
statement {
sid = "1"
actions = [
@mdkent
mdkent / example.md
Last active August 1, 2019 17:28 — forked from miguno/kafka-move-leadership.sh
A simple Ops helper script for Apache Kafka to generate a partition reassignment JSON snippet for moving partition leadership away from a given Kafka broker. Use cases include 1) safely restarting a broker while minimizing risk of data loss, 2) replacing a broker, 3) preparing a broker for maintenance.
JMX_PORT=10203 ./kafka-move-leadership.sh --zookeeper 10.40.0.2:2181,10.40.0.3:2181,10.40.0.4:2181 --broker-id 913231889 --first-broker-id 276559255 --last-broker-id 276559255

Rdio -> Google Play Music

Abandon ship!

I've used the following method to export a playlist with 601 items, matching 580. The remaining 21 are a mix of artist or album mismatches, along with some tracks that just aren't available.

Requires

desc "Compile all the assets named in config.assets.precompile"
task :precompile do
# We need to do this dance because RAILS_GROUPS is used
# too early in the boot process and changing here is already too late.
if ENV["RAILS_GROUPS"].to_s.empty? || ENV["RAILS_ENV"].to_s.empty?
ENV["RAILS_GROUPS"] ||= "assets"
ENV["RAILS_ENV"] ||= "production"
Kernel.exec $0, *ARGV
else
Rake::Task["environment"].invoke
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Copyright:: Copyright (c) 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@mdkent
mdkent / 0-readme.md
Created January 30, 2012 18:58 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@mdkent
mdkent / default.rb
Created January 6, 2012 18:50 — forked from miketheman/default.rb
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
@mdkent
mdkent / default.rb
Created January 6, 2012 18:18 — forked from miketheman/default.rb
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
/home/mkent/git/chef/chef/spec/support/matchers/leak.rb:21: uninitialized constant RSpec::Matchers (NameError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/mkent/git/chef/chef/spec/spec_helper.rb:104
from /home/mkent/git/chef/chef/spec/spec_helper.rb:104:in `each'
from /home/mkent/git/chef/chef/spec/spec_helper.rb:104
from log_spec.rb:21:in `require'
from log_spec.rb:21
--- a/chef/spec/support/matchers/leak.rb
# don't bother if this is a xen guest, we get sync'd from dom0
v = node[:virtualization]
if v[:role] == "guest" and (v[:system] == "xen")
package "ntp" do
action :remove
end
return
end
package "ntp" do