Skip to content

Instantly share code, notes, and snippets.

View textgoeshere's full-sized avatar

Dave Nolan textgoeshere

View GitHub Profile
@textgoeshere
textgoeshere / script.js
Created July 13, 2011 09:45
console killer
if (typeof window.console == "undefined") {
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}
@textgoeshere
textgoeshere / grr
Created October 4, 2011 21:31
quick and dirty script to "growl" notify outcome of long-running command
#!/bin/bash
# create an array from the params
declare -a CMD=($*)
# execute the command given by the params
${CMD[@]}
# notify the outcome given by the exit code
if [ $? == 0 ]
then
notify-send "${CMD[0]} passed" -i gtk-dialog-info
@textgoeshere
textgoeshere / graphline.sh
Created July 20, 2012 14:36 — forked from mrtazz/graphline.sh
shell function to quickly check a graphite graph
#
# shell function to print graphite graphs as sparklines in the terminal
# needs https://github.com/holman/spark
#
function graphline() {
GRAPHITEHOST="graphite.example.com"
if [ ! -n "$1" ]; then print "Usage: $0 metric [minutes]"; return 1; fi
if [ ! -n "$2" ]; then MINUTES=10 ; else MINUTES=$2; fi
curl -s "${GRAPHITEHOST}/render?from=-${MINUTES}minutes&target=${1}&format=raw" | cut -d"|" -f 2 | spark ;
}
@textgoeshere
textgoeshere / request_start_variable.patch
Created August 20, 2012 04:29 — forked from rkbodenner/request_start_variable.patch
Add a 'start_time' variable to nginx 0.8.33 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 2010-01-11 03:21:46.000000000 -0800
+++ src/http/ngx_http_variables.c 2010-02-18 10:01:32.000000000 -0800
@@ -93,6 +93,9 @@
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);
+
/*
port = lambda do |env|
body = "Hello from variant #{ENV['VARIANT']} on #{env['SERVER_NAME']}:#{env['SERVER_PORT']} at #{env['HTTP_X_TIME']}"
[200, {"Content-Type" => "text/html"}, [body]]
end
run port
@textgoeshere
textgoeshere / splitter example conf
Created October 4, 2012 13:49
basic nginx conf for continuous experimentation
upstream _a {
server 127.0.0.1:8000;
}
upstream _b {
server 127.0.0.1:8001;
}
upstream _c {
server 127.0.0.1:8002;
@textgoeshere
textgoeshere / gist:4176973
Created November 30, 2012 16:54 — forked from baob/gist:4176946
Elastic Search File Not Found Errors
... 10 more
[2012-11-30 16:48:58,470][WARN ][index.gateway ] [i-b41873ed] [lodgings][4] failed to snapshot (scheduled)
org.elasticsearch.index.gateway.IndexShardGatewaySnapshotFailedException: [lodgings][4] Failed to perform snapshot (index files)
at org.elasticsearch.index.gateway.blobstore.BlobStoreIndexShardGateway.doSnapshot(BlobStoreIndexShardGateway.java:246)
at org.elasticsearch.index.gateway.blobstore.BlobStoreIndexShardGateway.snapshot(BlobStoreIndexShardGateway.java:160)
at org.elasticsearch.index.gateway.IndexShardGatewayService$2.snapshot(IndexShardGatewayService.java:271)
at org.elasticsearch.index.gateway.IndexShardGatewayService$2.snapshot(IndexShardGatewayService.java:265)
at org.elasticsearch.index.engine.robin.RobinEngine.snapshot(RobinEngine.java:1056)
at org.elasticsearch.index.shard.service.InternalIndexShard.snapshot(InternalIndexShard.java:481)
at org.elasticsearch.index.gateway.IndexShardGatewayService.snapshot(
require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3:

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

#!/usr/bin/env bash
###############################################################
# Prevents a commit when Gemfile has references to local gems #
###############################################################
if
test "$(git diff-index --cached HEAD -G'\Wpath(:|\s?=\>)' -- Gemfile)"
then
echo "Error: you have references to local gems in your Gemfile. Commit aborted."