Skip to content

Instantly share code, notes, and snippets.

@rduplain
rduplain / fancontrol-init.sh
Created October 5, 2010 16:33
SysV init script for fancontrol to keep deskside servers quiet (USE WITH CAUTION).
#! /bin/sh
# Save as /etc/init.d/fancontrol
# update-rc.d fancontrol defaults 90 10
#
# Based on /etc/init.d/skeleton
# Tested on a Supermicro 1U box running Ubuntu 10.04 x86_64.
### BEGIN INIT INFO
# Provides: fancontrol
# Required-Start:
# Required-Stop:
@rduplain
rduplain / .bootstrap.md
Created October 5, 2010 21:17
Instructions and configuration to get started with gitolite git hosting.

Git Hosting

  • GitHub.com provides great public repository hosting.
  • vanilla git over ssh works for simple project structures.
  • gitosis works well where you'd like to use ssh pubkeys without shell access.
  • gitolite works well where you'd like gitosis to have finer access control.

How I setup our gitolite server

@benpickles
benpickles / minify
Created January 4, 2011 21:17
Swiftly concat and minify JavaScript files from the command line
#!/usr/bin/env ruby
dry_run = ARGV.delete('--dry-run')
force = ARGV.delete('--force')
if ARGV.empty?
puts <<-USAGE
minify, swiftly concat and minify JavaScript files from the command line
Pass a single argument to create a .min.js version:
@fj
fj / gist:1065069
Last active September 26, 2015 07:58
First Wednesdays Charlottesville info
@justincbeck
justincbeck / gist:1783723
Created February 9, 2012 22:14
Drop a commit
# git rebase -i head~n (where n is the number of commits from head you want)
# You will see something like this:
pick 907cdd8 Added new files to project
pick 8be0e96 Recent profile view pull to reload
# Rebase a1cd6ef..8be0e96 onto a1cd6ef
#
# Commands:
@ask
ask / gist:2014539
Created March 11, 2012 01:57
celery consumer service using boot-steps.
from celery import abstract
from celery import current_app
from kombu import Exchange, Queue
from kombu.mixins import ConsumerMixin
# need to subclass the result backend so that it uses a topic exchange
# instead of direct, and send the results for tasks using a routing_key
# of the format:
@rduplain
rduplain / commitments.rst
Created June 23, 2012 21:14
A commitment spec, a data model in structured text for injestion. Collaboration with mattd.

Life Area

Commitment 1

Program

@mkaito
mkaito / post-receive
Created July 27, 2012 02:49
post-receive hook to notify our hubot instance
#!/usr/bin/env ruby
# Notify hubot when someone pushes.
require 'net/http'
branches = []
cnum = 0
STDIN.each do |line|
(oldref, newref, refname) = line.split
branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp
@rduplain
rduplain / get.py
Last active October 13, 2015 01:47
Build a road-trip curated mp3 directory of a podcast. Our car plays .mp3 files from CD & USB,
"Build a road-trip curated mp3 directory of a podcast."
# Developed against feedparser v5.1.2 and BeautifulSoup v3.2.1.
# pip install feedparser BeautifulSoup
import datetime
import re
import time
import urllib
@rduplain
rduplain / linode-node-balancer-500-limitation.md
Last active November 1, 2015 04:20
Linode NodeBalancer: Passive health checks lead to many false positives.

Linode's NodeBalancer assumes (as of Apr 2015) that a 500 response means that the node should be removed from rotation. Naturally, exceptions happen, so this is a very serious design limitation for any application which allows its code to have uncaught exceptions. I have opened a support ticket, with discussion copied here.

Ultimately, we had to rewrite our 500 responses to a non-50x response, which is strange to our application, but at least the change was limited to an nginx config and a single line of JavaScript to handle our status code as a server error. Linode specifically advised to use a non-50x response. All we need is a configuration in the NodeBalancer to not use passive checks on 500 Internal Server Error responses. There is no such configuration.

Due to the head-scratching nature of this configuration, we used 418 I'm a teapot in place of 500 responses. In nginx:

proxy_intercept_errors on;

error_page 500 =418 /_error/internal-serve