Skip to content

Instantly share code, notes, and snippets.

@chrisk
chrisk / gist:10630382
Created April 14, 2014 09:08
Patch for pgrep bug in /etc/init.d/dropbox
--- /etc/init.d/dropbox
+++ /etc/init.d/dropbox-fixed
@@ -26,7 +34,8 @@
status() {
for dbuser in $DROPBOX_USERS; do
- dbpid=`pgrep -u $dbuser dropbox`
+ HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
+ dbpid=`ps -u $dbuser -o pid,cmd | grep "$HOMEDIR"/"$DAEMON"\$ | awk '{ print \$1 }'`
if [ -z $dbpid ] ; then
#!/bin/sh
set -x
sudo sed -i 's/wheezy/testing/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
sudo apt-get install -y build-essential ruby ruby-dev
sudo gem update --system
#!/usr/bin/env ruby
require 'rubygems'
require 'rbosa'
sp = OSA.app 'System Preferences'
se = OSA.app 'System Events'
sp.current_pane = sp.panes.detect { |p| p.properties[:id] == 'com.apple.preference.keyboard' }
@chrisk
chrisk / .autotest.rb
Created August 26, 2008 18:46
My ~/.autotest
require 'pathname'
p = Pathname.new(__FILE__)
puts "loading #{p.realpath}"
# Load sound effects library and sounds
# From http://fozworks.com/2007/7/28/autotest-sound-effects
require '~/.autotest_extras/sound.rb'
Autotest::Sound.sound_path = "~/.autotest_extras/sound_fx/"
# Tell autotest to ignore changes to files that infrequently change or aren't related
@chrisk
chrisk / mongrel_process_memory.rb
Created October 16, 2008 20:56
/etc/munin/plugins/mongrel_process_memory
#!/usr/local/bin/ruby
#
# mongrel_process_memory - A munin plugin to monitor memory size of
# each individual mongrel process
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
#!/bin/bash
#
# Pushes the earliest commit from the current branch (using git-svn dcommit),
# keeping your other unpushed commits intact and updating the pushed commit
# with git-svn metadata.
#
# Usage:
# git pushone
#
#!/bin/bash
#
# ~/bin/git-notpushed
#
# Shows commits you haven't pushed to the remote yet. Optionally
# accepts same arguments as git-log. Assumes 'trunk' is the
# default remote if no branch.<current>.remote configuration exists.
#
# Uses git-svn instead of pure git; see comments below.
#
@chrisk
chrisk / .inputrc
Created January 9, 2009 01:46
Some old dotfiles from aught-nine
# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
# the subset of the history starting with that text
# is searched.
"\e[B": history-search-forward
"\e[A": history-search-backward
// ==UserScript==
// @name Hide labels in story lists
// @namespace http://shiftcommathree.com
// @description Hides the small green labels before each story title
// @include http://www.pivotaltracker.com/projects/*
// @include http://pivotaltracker.com/projects/*
// @author Chris Kampmeier
// ==/UserScript==
function addGlobalStyle(css) {
@chrisk
chrisk / archfear.rb
Created February 14, 2009 03:10 — forked from archfear/archfear.rb
# Template which configures a generic Rails app with Shoulda, Factory Girl,
# HAML, etc while commiting each step into git.
#
# Make sure you have Rails 2.3rc1 or greater installed and run:
# rails -d mysql -m http://gist.github.com/raw/57458/06345c42a92048e699af3140ccd28bbcd8915bc5/archfear.rb my_app
# Helper methods
# Modified version of the "gem" method which places the "config.gem..." lines
# after the examples in config/environment.rb.