Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am michaeldauria on github.
  • I am michaeldauria (https://keybase.io/michaeldauria) on keybase.
  • I have a public key ASDoOtMtPcjjIUdYX_kGut6ri3OA_ra2JOJdsfI4TqjJ8Qo

To claim this, I am signing this object:

@michaeldauria
michaeldauria / fetch_lookupds.js
Created November 19, 2014 21:36
Bitly NSQ Data Streams via nsqjs
var nslookupdOptions = {
hostname: 'api-ssl.bitly.com',
path: '/v3/nsq/lookup?topic=topic&access_token='+access_token,
};
var lookupds = [];
var request = https.request(nslookupdOptions, function(res) {
res.on('data', function(response) {
JSON.parse(response).data.producers.forEach(function(nslookupd) {
nslookupds.push(nslookupd.hostname+':'+nslookupd.tcp_port);
require 'fog'
require 'net/ssh'
pretend = false
backup_volumes = {
'hostname' => [
{
:device => '/dev/xvdf',
:mount => '/srv/mongo'
$ brew install grok [ruby-1.9.3-p125]
Warning: You have Xcode-4.3, which is outdated.
Please install Xcode 4.3.3.
==> Installing grok dependency: tokyo-cabinet
==> Downloading http://fallabs.com/tokyocabinet/tokyocabinet-1.4.47.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/tokyo-cabinet/1.4.47 --enable-fastest
==> make
==> make install
/usr/local/Cellar/tokyo-cabinet/1.4.47: 77 files, 4.6M, built in 14 seconds
@michaeldauria
michaeldauria / request_start_variable.patch
Created June 7, 2012 17:16
Add a 'start_time' variable to nginx 1.2.1 to support an X-REQUEST-START header. This header is used by New Relic RPM to record queue time.
--- src/http/ngx_http_variables.c.orig 2012-06-07 12:47:34.000000000 -0400
+++ src/http/ngx_http_variables.c 2012-06-07 12:55:51.000000000 -0400
@@ -99,6 +99,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
/*
@michaeldauria
michaeldauria / replica_set_migration.rb
Created May 29, 2012 21:28
Migrate from mongodb master/slave to replica sets
#!/bin/env ruby
# Caveat: your must ensure no writes are going into the system
# Total time for this migration, including a restart of mongo
# is less than 10s
require 'mongo'
replica_set = 'replica_set_name'
primary_host = 'primary.local'
@michaeldauria
michaeldauria / gist:2048022
Created March 16, 2012 01:09
Migrating from Copycopter to your own instance
Once you have your own instance of copycopter-server running, you need to do the following:
1. Create a new project and take note of its hostname and api key
2. Make sure you are on the latest version of the copycopter_client gem, at the time of this writing it is 2.0.0
3. Export the latest version of your published drafts:
$ RAILS_ENV=production bundle exec rake copycopter:export