Skip to content

Instantly share code, notes, and snippets.

View hunter's full-sized avatar

Hunter Nield hunter

View GitHub Profile
@hunter
hunter / graphline.sh
Created July 31, 2012 02:08 — 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 ;
}
@hunter
hunter / deploy log
Created March 31, 2012 00:27
WC deploy
triggering load callbacks
* executing `la-1-9'
triggering start callbacks for `deploy'
* executing `multistage:ensure'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:wdamarillo/web_client.git master"
@hunter
hunter / VBoxSVC.log
Created February 23, 2012 03:01
Log
00:00:00.000 main OS Service Pack: #72-Ubuntu SMP Fri Jul 29 21:21:55 UTC 2011
00:00:00.000 main Executable: /usr/lib/virtualbox/VBoxSVC
00:00:00.000 main Process ID: 10550
00:00:00.000 main Package type: LINUX_64BITS_UBUNTU_10_04
00:00:00.106 nspr-2 Loading settings file "/home/x/.VirtualBox/VirtualBox.xml" with version "1.12-linux"
00:00:00.585 nspr-2 Successfully initialised host USB using sysfs
00:00:00.608 nspr-2 VDInit finished
00:00:00.994 nspr-2 ERROR [COM]: aRC=VBOX_E_OBJECT_NOT_FOUND (0x80bb0001) aIID={c28be65f-1a8f-43b4-81f1-eb60cb516e66} aComponent={VirtualBox} aText={Could not find a registered machine named 'oneiric'}, preserve=false
00:00:00.994 nspr-2 ERROR [COM]: aRC=VBOX_E_OBJECT_NOT_FOUND (0x80bb0001) aIID={c28be65f-1a8f-43b4-81f1-eb60cb516e66} aComponent={VirtualBox} aText={Could not find an open hard disk with location '/home/hnield/VirtualBox VMs/oneiric/box-disk1.vmdk'}, preserve=false
00:00:26.580 nspr-2 ERROR [COM]: aRC=VBOX_E_OBJECT_NOT_FOUND (0x80bb0001)
module Rankable
extend ActiveSupport::Concern
included do
field :ratings_value_sum, :type => Integer, :default => 0
field :ratings_count, :type => Integer, :default => 0
embeds_many :ratings
end
jQuery(function() {
$.cookie('tz', (new Date()).getTimezoneOffset());
});
ruby test/unit/social_item_test.rb
/Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta/lib/rails.rb:40:in `configuration': undefined method `config' for nil:NilClass (NoMethodError)
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/factory_girl-1.2.3/lib/factory_girl.rb:25:in `<top (required)>'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:41:in `require'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:41:in `block (2 levels) in require'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:36:in `each'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:36:in `block in require'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:35:in `each'
from /Users/hunter/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.7/lib/bundler/runtime.rb:35:in `require'
from /Use
/* http://burkelibbey.posterous.com/the-konami-code */
(function(){
var s=0,w=window,k=[38,38,40,40,37,39,37,39,66,65];
$(w).keydown(function(e){
if((e.keyCode==k[s]?++s:s=0)>9)w.location="http://example.com/secret";
});
})();
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
# Used to graph results from autobench
#
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv
#
# This will generate three svg & png graphs
require "rubygems"
require "scruffy"
require 'csv'
require 'yaml'
server {
listen 80;
server_name www.domain.com;
rewrite ^/(.*)$ http://domain.com/$1 redirect;
}