Skip to content

Instantly share code, notes, and snippets.

View tdooner's full-sized avatar

Tom Dooner tdooner

View GitHub Profile
@tdooner
tdooner / screen_notes.md
Created September 7, 2011 22:04
Lightning Talk - Screen (Terminal Multiplexing)

Terminal Multiplexing and YOU!

Screen gives you a terminal which can persist after your SSH connection has closed.

Reasons to use a terminal multiplexer:

  • Run a lengthy program (crunching, or a Minecraft server, etc.) even after you disconnect.
  • Allows you to resume working exactly where you left off, after your connection breaks or you switch computers.
@tdooner
tdooner / sidekiq.rb
Last active October 14, 2022 12:12
Sidekiq Redis Sentinel configuration
# config/initializers/sidekiq.rb
Sidekiq.configure_client do |config| # and repeat this inside a Sidekiq.configure_server
config.redis = {
master_name: 'your-master-name',
sentinels: [
"sentinel://sentinel01.example.com:26379",
"sentinel://sentinel02.example.com:26379",
"sentinel://sentinel03.example.com:26379",
],
failover_reconnect_timeout: 20, # roughly 3-5 seconds longer than the sentinel failover-timeout
@tdooner
tdooner / redis-failover.rb
Created August 29, 2014 21:23
Redis Sentinel Failover Testing Script
require 'redis'
require 'redis-sentinel'
require 'timeout'
require 'logger'
class TestClient
def initialize
@sentinels = [
{ host: 'sentinel01.example.com', port: 26379 },
{ host: 'sentinel02.example.com', port: 26379 },
@tdooner
tdooner / -
Created September 25, 2014 23:44
diff --git a/webpack.config.js b/webpack.config.js
index ff2c436..b779dbc 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,6 +1,7 @@
/* global __dirname:false */
-var webpack = require('webpack');
+var webpack = require('webpack'),
+ exec = require('child_process').exec;
@tdooner
tdooner / sagaaaa
Last active August 29, 2015 14:14
elevator saga WIP
{
elevators: [],
floorsWaitingUp: [],
floorsWaitingDown: [],
registerElevator: function(elevator) {
elevator.i = this.elevators.length;
elevator.log = function(msg) {
if (this.i !== 0) { return; }
@tdooner
tdooner / -
Created February 17, 2015 22:36
#!/usr/bin/env ruby
require 'yaml'
require 'base64'
contents = "#cloud-config\n" + {
'bootcmd' => [
'yum remove zsh -y',
'yum install zsh -y'
]
}.to_yaml
# To use this script, download a CSV of incidents from Pagerduty, e.g
# https://causes.pagerduty.com/csv/incidents?since=2015-08-10T00:00:00-07:00&until=2015-08-17T23:59:59-07:00
require 'csv'
require 'date'
ENV['TZ'] = 'America/Los_Angeles'
def average(array, round = 1)
(array.inject(0, :+) / array.length.to_f).round(round)
end
{
"schedule": "R/2014-09-25T17:22:00Z/PT2M",
"name": "tomtest",
"shell": false,
"container": {
"type": "DOCKER",
"image": "tdooner/tdooner-chronos-test",
"network": "BRIDGE",
"volumes": []
},
time="2015-12-09T19:55:09.554822173Z" level=debug msg="authorizing request" environment=production go.version=go1.4.2 http.request.host=[our-registry] http.request.id=ff863c72-e8d4-401e-8092-eb863cd37fbf http.request.method=PUT http.request.remoteaddr=[...] http.request.uri="/v2/brigade-ruby-2.2.3/blobs/uploads/4a427f49-1355-483e-8970-1be08226f82b?_state=[...]&digest=sha256%3A3e50e9d212ab239ad8a73309ad12c53e0a9d2ca92135d2b7fff08f07f9f5e321" http.request.useragent="docker/1.8.3 go/go1.4.2 git-commit/f4bf5c7 kernel/3.10.0-229.el7.x86_64 os/linux arch/amd64" instance.id=f75653e6-a2c5-4e2c-a6e8-4ed30d141d17 service=registry vars.name=brigade-ruby-2.2.3 vars.uuid=4a427f49-1355-483e-8970-1be08226f82b version="v2.1.0+unknown"
time="2015-12-09T19:55:09.55503649Z" level=debug msg="(*linkedBlobStore).Resume" environment=production go.version=go1.4.2 http.request.host=[our-registry] http.request.id=ff863c72-e8d4-401e-8092-eb863cd37fbf http.request.method=PUT http.request.remoteaddr=[...] http.request.uri="/v2/brigade-r
@tdooner
tdooner / hi-josh
Last active December 15, 2015 02:11
hi josh
can you send me rent money please?