Here are some things I have learned along the way.
Last Updated: 2013-02-08
Original Audience: Hack Reactor
| 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 |
| $ 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 |
| /** | |
| * 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 |
Here are some things I have learned along the way.
Last Updated: 2013-02-08
Original Audience: Hack Reactor
| 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 |
This will demonstrate how to upload build files from Travis CI to S3.
NOTE: Keys have been changed to protect the innocent.
Create an S3 ACL policy, see s3_policy.json for an example.
| #!/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: |
| https://papertrailapp.com/systems/setup | |
| # sudo sh | |
| # cd /etc | |
| # wget https://papertrailapp.com/tools/syslog.papertrail.crt | |
| # yum install rsyslog-gnutls |
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:
| 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. |