Skip to content

Instantly share code, notes, and snippets.

View dennyabraham's full-sized avatar
💭
🚁🦖

Denny Abraham dennyabraham

💭
🚁🦖
View GitHub Profile
module God
module Conditions
class RestartFileTouched < PollCondition
attr_accessor :restart_file
def initialize
super
end
def process_start_time
Time.parse(`ps -o lstart -p #{self.watch.pid} --no-heading`)
# Ruby 1.8
m { }
arity: -1
proc call arg check: no
wraps values: n/a
m { || }
arity: 0
proc call arg check: yes, 0
@josevalim
josevalim / application.rb
Created December 6, 2011 11:54
Potentially faster boot
# THANKS EVERYONE FOR YOUR BELOVED BENCHMARKS.
# THIS PATCH IS NOW IN RAILS:
#
# https://github.com/rails/rails/commit/885a599303585b796da7a0a1c3ccd0bc5c642134
# Please add the following lines after Bundler.require
# and before "class Application < Rails::Application"
# in your config/application.rb
#
# Notice this is just an experiment, don't leave those
@jeroenvandijk
jeroenvandijk / postgres.clj
Created July 19, 2012 09:39
Cascalog JDBC example
(ns queries.postgres
(:gen-class)
(:require [cascalog.ops :as c])
(:use [cascalog.api])
(:import [com.twitter.maple.jdbc JDBCTap JDBCScheme TableDesc]
[cascading.tap.SinkMode]))
(defn db-tap [table]
(let [tap (com.twitter.maple.jdbc.JDBCTap.
"jdbc:postgresql://my-db-uri?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"
@bryanveloso
bryanveloso / brew-services.rb
Created December 8, 2011 09:39 — forked from lwe/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
require 'rubygems'
require 'spoon'
Spoon.spawnp 'jruby', *ARGV
@bdotdub
bdotdub / redis.markdown
Created November 24, 2010 22:18
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@chrismytton
chrismytton / 01-README.md
Created October 29, 2012 20:46
Mutt Gmail config with OS X keychain

Mutt/Gmail/OS X Keychain

Create a new keychain item, enter the Keychain Item Name as mutt, the Account Name as your gmail email address and then enter your password, then add the keychain item.

2-step auth

If you're using Google 2-step auth, you'll need to generate an Application-specific password from your Google Account settings and enter that as the password.

@defunkt
defunkt / connection_fix.rb
Created November 19, 2009 20:00
MySQL server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/