Skip to content

Instantly share code, notes, and snippets.

Michael Pearson mipearson

Block or report user

Report or block mipearson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mipearson
mipearson / buildkite_which_queue.md
Created Dec 11, 2018
Grabbing a list of which Buildkite pipelines use which agent queues
View buildkite_which_queue.md

Run this query via the graph explorer:

{
  organization(slug: "your-org-slug") {
    pipelines(first: 500) {
      edges {
        node {
          name
@mipearson
mipearson / index.ts
Created Aug 19, 2018
Demonstration of using AWS CDK
View index.ts
/*
I was curious as to whether it was possible to make resources
created using CDK constructs work with raw CloudFormation
resources and vice versa.
This aws-cdk app demonstrates a VPC and an ELB that belongs to it
in different, dependant stacks, leveraging CFN outputs / imports,
and leveraging CDK's method of passing information from one
stack to another.
*/
@mipearson
mipearson / elk.rb
Created Jul 5, 2018
Structured Logging with Rails & ELK example files
View elk.rb
# Copyright 2018 Marketplacer. MIT License.
require 'json'
require 'active_support/core_ext/class/attribute'
require 'active_support/log_subscriber'
module Elk
class RequestLogSubscriber < ActiveSupport::LogSubscriber
PAYLOAD_KEYS_TO_COPY = %i{
controller
View development_view_resolve_caching.rb
# include this mixin (or put the code directly) into your application_controller.rb
module Shared
module DevelopmentViewResolveCaching
extend ActiveSupport::Concern
# Speeds up development view rendering by about ~300ms as we don't need
# to call the slow view resolver more than once per partial.
#
# From https://github.com/rails/rails/issues/20752
View capybara_timers.rb
# Copyright 2018 Marketplacer under the MIT license.
class CapybaraTimers
class << self
attr_accessor :nesting, :total_time
def setup
# Wrap every DSL method and every matcher with our timing function
Capybara::Session::DSL_METHODS.each do |name|
setup_timer_on_method(Capybara::DSL, name)
end
View scrabble_benchmarking.rb
POINTS = {
"A" => 1, "B" => 3, "C" => 3, "D" => 2,
"E" => 1, "F" => 4, "G" => 2, "H" => 4,
"I" => 1, "J" => 8, "K" => 5, "L" => 1,
"M" => 3, "N" => 1, "O" => 1, "P" => 3,
"Q" => 10, "R" => 1, "S" => 1, "T" => 1,
"U" => 1, "V" => 4, "W" => 4, "X" => 8,
"Y" => 4, "Z" => 10
}
View scrabble_benchmarking.rb
POINTS = {
"A" => 1, "B" => 3, "C" => 3, "D" => 2,
"E" => 1, "F" => 4, "G" => 2, "H" => 4,
"I" => 1, "J" => 8, "K" => 5, "L" => 1,
"M" => 3, "N" => 1, "O" => 1, "P" => 3,
"Q" => 10, "R" => 1, "S" => 1, "T" => 1,
"U" => 1, "V" => 4, "W" => 4, "X" => 8,
"Y" => 4, "Z" => 10
}
@mipearson
mipearson / lib__npm_check.rb
Last active Sep 1, 2016
Simple NPM version checker
View lib__npm_check.rb
class NpmCheck
# Checks package.json against the local node_modules directory
# to assert that every package specified in package.json is
# present in node_modules. If possible, it performs a basic
# "newer or equal than" check on the package's version. Without
# access to npm's semver primitizes & parsing it is a bit more difficult
# to perform proper version matching checks.
#
# Requires https://github.com/jlindsey/semantic to parse versions.
#
View infrastructure.md

Senior Infrastructure Engineer @ Marketplacer

Would you like to work with a small and motivated team where your decisions matter? Would you like to take an existing server & deployment architecture and help us rebuild it from the ground up?

Marketplacer is building one of Australia's leading eCommerce platforms and we are looking for an exceptional Infrastructure Engineer to join our team.

Here's a few reasons why working for us is awesome:

  • Our large, well furnished office is in South Melbourne and is near the excellent cafes of Bay St and only a couple of minutes walk from the 109 tram.
  • You'll be provided with a top-of-the-line laptop or desktop (Apple or otherwise) and any software that you need to do your job.
View goservice.md

Requirements:

  • Be restartable without denying or prematurely closing requests (unicorn's SIGUSR2 being the "gold standard")
  • Log information about requests in logstash compatiable JSON, including request path, request time & status code. Optionally should include request parameters, content length, content type & time spent in DB, views, external services
  • Report exceptions to Rollbar & not die if an exception is encountered
  • Connect to external resources via environment variables, optionally also via command line flags (cf 12factor app)
  • Allow for automatic destruction/creation of database tables in tests
  • Allow for programmatic migration of database tables in production (standard: rake db:migrate)
  • Require no filesystem resources other than its own binary (eg, no db.yml or migrations directory)
You can’t perform that action at this time.