Skip to content

Instantly share code, notes, and snippets.

@robwilkerson
robwilkerson / vagrant_share_debug.log
Created October 14, 2015 20:54
VAGRANT_LOG=debug output from `vagrant share`
$ VAGRANT_LOG=debug vagrant share | tee vagrant_share_debug.log
INFO global: Vagrant version: 1.7.4
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_OLD_ENV_XPC_FLAGS="0x0"
INFO global: VAGRANT_OLD_ENV_USER="robwilkerson"
INFO global: VAGRANT_OLD_ENV_LOGNAME="robwilkerson"
INFO global: VAGRANT_OLD_ENV_OLDPWD="/Users/robwilkerson/Development/socrates/socrates-dashboard"
INFO global: VAGRANT_OLD_ENV_LESS_TERMCAP_md=""
// routes/index.js
module.exports = function(server) {
server.pre(function (req, res, next) {
console.log(req.body); // prints "undefined"
return next();
});
// snip
@robwilkerson
robwilkerson / server.js
Last active August 29, 2015 14:20
A simple test of restify versioning.
/* jshint node:true */
'use strict';
var restify = require("restify"),
server = restify.createServer({ version: '1.0.0' });
server.pre(function (req, res, next) {
console.log('VERSION HEADER: %s', req.headers['accept-version']);
console.log('VERSION VIA RESTIFY: %s', req.version());
@robwilkerson
robwilkerson / default.vcl
Created December 30, 2014 15:40
Varnish Config
backend default {
.host = "127.0.0.1";
.port = "8080";
}
acl purge {
# Add local/internal server IPs
"localhost";
"127.0.0.1";
@robwilkerson
robwilkerson / nightwatch-browserstack.js
Created June 10, 2014 13:59
Nightwatch details of a Browserstack test failure.
Running: Slider rotation when top thumbnail is clicked
INFO Request: POST /wd/hub/session
- data: {"desiredCapabilities":{"browserName":"firefox","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","browserstack.user":"USER","browserstack.key":"KEY"}}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":194}
INFO Response 200 POST /wd/hub/session{ state: null,
sessionId: '512bf86df82ca7ccb05b2f32495fa603a3e15cc2',
hCode: 1182579454,
value:
{ applicationCacheEnabled: true,
C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.7.0/lib/net/ssh/authentication
/agent/socket.rb:81:in `negotiate!': unknown response from agent: 1, "\x00\x00\x
00-\x01\x00\x00\x00(SSH-2.0-Ruby/Net::SSH_2.7.0 i386-mingw32" (Net::SSH::Authent
ication::AgentError)
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.7.0/lib/net/ssh/a
uthentication/agent/socket.rb:48:in `connect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.7.0/lib/net/ssh/a
uthentication/key_manager.rb:178:in `agent'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.7.0/lib/net/ssh/a
uthentication/key_manager.rb:102:in `each_identity'
@robwilkerson
robwilkerson / distance.js
Created February 7, 2014 20:53
Computes the distance in miles between two sets of coordinates.
/**
* Computes the distance in miles between two sets of coordinates.
*
* @param object from object containing longitude and latitude members
* @param object to object containing longitude and latitude members
* @return number
*/
Inova.Models.Location.distance = function(from, to) {
// approx. dist in miles, nothern hemisphere
// http://www.meridianworlddata.com/Distance-Calculation.asp
@robwilkerson
robwilkerson / server-health.md
Created December 10, 2013 12:51
Tools & techniques for monitoring server health.

Server Health

Command Line Tools

  • top

  • uptime: Pay attention to the load average value.

  • free -m: Indicates how much memory is available. Some memory is used by the machine trying to anticipate, but it's still available. That's why the second row in the free column is key.

                   total       used       free     shared    buffers     cached
    

Mem: 991 763 227 0 69 464

@robwilkerson
robwilkerson / provision.vm.sh
Created November 21, 2013 02:32
A Vagrant provisioner file template.
#!/bin/bash
# Provisions the Vagrant VM for this project. This file should never be
# executed manually. It is intended to be run only in the context of the
# `vagrant up` execution.
# NOTE: This script is executed by Vagrant as the root user.
set -e
@robwilkerson
robwilkerson / Vagrantfile
Created November 21, 2013 02:12
Vagrant 1.3.x Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64-dev"