Skip to content

Instantly share code, notes, and snippets.

View addisonj's full-sized avatar

Addison Higham addisonj

View GitHub Profile
[
"ackbar"
, "commandlinefu.coffee"
, "facepalm.coffee"
, "github-issue-link.coffee"
, "grumpycat.coffee"
, "karma.coffee"
, "redis-brain.coffee"
, "robot-memes.coffee"
, "shipit.coffee"
@addisonj
addisonj / rm-corrupt.sh
Last active December 23, 2015 05:28 — forked from codepunkt/rm-corrupt.sh
Checks all the wsp files in a whisper storage and deletes any corrupt files
#!/bin/bash
matches=()
directory='/opt/graphite/storage/whisper'
for file in $(find $directory -type f -name '*.wsp' -print); do
$(python /usr/local/bin/whisper-info.py $file > /dev/null 2>&1)
retval=$?
echo "checking $file"
[ $retval -ne 0 ] && matches+=($file)
Denormalizing roviIds on teams...
Denormalizing sourceIds on upcoming games...
matching games 2013-04-23
matched 20 games
unmatched games: [ '1283609 Twins Marlins on Fox Sports Florida, Fox Sports North - Minnesota' ]
matching games 2013-04-24
matched 19 games
unmatched games: [ '1282616 White Sox Indians on SportsTime Ohio, Comcast Sports Network',
'1322200 Twins Marlins on Fox Sports Florida, Fox Sports North - Minnesota',
'1284153 Astros Mariners on ROOT SPORTS, Comcast Sports Network',
@addisonj
addisonj / collectd.conf
Created November 7, 2012 15:27
Collectd issues on ubuntu 12.04 and python plugins
#
# This file is generated by Chef
# Do not edit, changes will be overwritten
#
Hostname ""
FQDNLookup true
BaseDir "/opt/collectd"
PluginDir "/opt/collectd/lib/collectd"
TypesDB "/opt/collectd/share/collectd/types.db"
@addisonj
addisonj / myRecipe.rb
Created September 28, 2012 04:45
Get an error about node['ec2'] being nil
file "/etc/chef/ohai/hints/ec2.json" do
action :create
end
ohai "reload" do
action :reload
end
execute "create and mount non provisioned EBS volumes" do
while [ ! -e /dev/xvdh1 ]; do echo waiting for /dev/xvdh1 to attach; sleep 10; done
while [ ! -e /dev/xvdh2 ]; do echo waiting for /dev/xvdh2 to attach; sleep 10; done
while [ ! -e /dev/xvdh3 ]; do echo waiting for /dev/xvdh3 to attach; sleep 10; done
while [ ! -e /dev/xvdh4 ]; do echo waiting for /dev/xvdh4 to attach; sleep 10; done
while [ ! -e /dev/xvdh5 ]; do echo waiting for /dev/xvdh5 to attach; sleep 10; done
while [ ! -e /dev/xvdh6 ]; do echo waiting for /dev/xvdh6 to attach; sleep 10; done
while [ ! -e /dev/xvdh7 ]; do echo waiting for /dev/xvdh7 to attach; sleep 10; done
while [ ! -e /dev/xvdh8 ]; do echo waiting for /dev/xvdh8 to attach; sleep 10; done
apt-get update > /tmp/apt-get-update.log 2>&1
apt-get install -y mongodb-10gen > /tmp/apt-mongo.log 2>&1
@addisonj
addisonj / ServiceProxy.coffee
Created May 22, 2012 15:38
a small wrapper for request that does fancy things
request = require 'request'
_ = require 'underscore'
transformUrl = (host, url) ->
return host + url
onError = (err, req, res) ->
res.send "an error occurred", 500
makeDefaults = (options) ->
@addisonj
addisonj / failApp.js
Created February 28, 2012 16:55
an app that fails
// this app is full of fail
var express = require("express")
exports.createServer = function() {
var app = express.createServer()
app.get('/', function(req, res) {
process.exit(1) // obviously not going to get past this
@addisonj
addisonj / finalRoute.js
Created December 21, 2011 20:57
normalize a response
// with normalizing middleware
app.use(normalizeResponse)
app.get('/account', common, UserRead)
function UserRead(req, res, next) {
// do stuff and attach it onto the res object
// call next() when done
next()
@addisonj
addisonj / gist:1163207
Created August 22, 2011 19:00
example of nested return from db
app.get('/jobs/:id', checkAuth, function(req, res, next) {
Job.findOne({ _id: req.params.id, user_id: req.session.user._id }, function(err, j) {
if (!j) return(new NotFound());
res.render('jobs/show', {
locals: {
j: j,
user: req.session.user
}
});