Skip to content

Instantly share code, notes, and snippets.

@jderrett
jderrett / copy_librato_dashboard.rb
Created February 29, 2016 19:32
Copy Librato Dashboard from one account to another
require 'faraday'
require 'faraday_middleware'
require 'json'
class DashboardApi
LIBRATO_API = 'https://metrics-api.librato.com'
LIBRATO_API_VERSION = 'v1'
ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/')
attr_accessor :username
@lmarburger
lmarburger / output
Last active December 22, 2015 21:59 — forked from TimMoore/curl-bundler-api
Timing rubygems spec.4.8 download from Fastly and S3. Run the test script and paste your results in a comment below: `curl -s https://gist.github.com/lmarburger/6537333/raw/time.sh | bash`
$ curl -s https://gist.github.com/lmarburger/6537333/raw/time.sh | bash
== Fastly ==
DNS: 0.156 CONNECT: 0.189 REQSENT: 0.488 STARTTX: 2.860 TOTAL: 5.583
X-Served-By: cache-v43-ASH, cache-ny58-NYC
X-Cache: MISS, MISS
DNS: 0.001 CONNECT: 0.040 REQSENT: 0.129 STARTTX: 0.174 TOTAL: 1.321
X-Served-By: cache-v43-ASH, cache-ny57-NYC
X-Cache: MISS, HIT
@slyphon
slyphon / KeyValueResult.scala
Created July 11, 2013 03:04
A super useful class for dealing with Futures and collections and dealing with results from backend data stores. Shout out to @caniszczyk for giving the OK to share this with the community. Authors: Jeremy Cloud, Kevin Oliver, Glen Sanford, and Evan Meagher
/**
* Copyright 2013 Twitter, Inc.
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@ryandotsmith
ryandotsmith / hack-reactor.md
Last active November 24, 2022 07:01
Hack Reactor Talk

Tales From a Heroku User

Here are some things I have learned along the way.

Last Updated: 2013-02-08

Original Audience: Hack Reactor

About

require 'connection_pool'
require 'redis'
require 'metriks'
class RedisClientWrapper
def initialize(options)
@options = options.delete(:pool)
@pool = ConnectionPool.new(@options) do
::Redis.new(options)
end
@mheffner
mheffner / README.md
Created October 3, 2012 18:11
Upload Travis CI builds to S3

Upload Travis CI builds to S3

This will demonstrate how to upload build files from Travis CI to S3.

NOTE: Keys have been changed to protect the innocent.

Step 1: Create an S3 policy.

Create an S3 ACL policy, see s3_policy.json for an example.

@dsc
dsc / jconsole-proxy.sh
Created August 7, 2012 01:15
jconsole via ssh proxy
#!/bin/bash
#/ jc -- jconsole via ssh proxy
#/
#/ Usage: jc [options] HOST JMX_PORT [PROXY_PORT=JMX_PORT] [JMX_HOST=HOST]
#/
#/ Starts a SOCKS proxy via ssh to connect to a
#/ JVM running on a remote and protected machine.
#/
#/ Arguments:
@ralph-tice
ralph-tice / papertails-quickstart
Created July 18, 2012 22:35
papertrails quickstart
https://papertrailapp.com/systems/setup
# sudo sh
# cd /etc
# wget https://papertrailapp.com/tools/syslog.papertrail.crt
# yum install rsyslog-gnutls
@ryandotsmith
ryandotsmith / process-partitioning.md
Created April 13, 2012 06:40
Process Partitioning

Process Partitioning

The Problem

When working with large, high volume, low latency systems, it is often the case that processing data sequentially becomes detrimental to the system's health. If we only allow 1 process to work on our data we run into several challenges:

  • Our process may fall behind resulting in a situation which it is impossible for our process to catch up.
  • Our singleton process could crash and leave our system in a degraded state.
  • The average latency of data processing could be dramatically affected by outlying cases.
@technoweenie
technoweenie / gist:2155760
Created March 22, 2012 04:03
track meta data with resque jobs, like when it was queued.
module Resque
def push_with_meta(queue, item)
if item.respond_to?(:[]=)
item[:meta] = {:queued_at => Time.now.to_f}
end
push_without_meta(queue, item)
end
class Job
# Returns a Hash of the meta data related to this Job.