Skip to content

Instantly share code, notes, and snippets.

View stve's full-sized avatar

Steve Agalloco stve

View GitHub Profile
@adambair
adambair / titler
Created April 26, 2009 15:06
Post your current iTunes track to Presently.
#!/usr/bin/env ruby
require 'rubygems'
require 'rbosa'
account='xxx'
username='xxx'
password='xxx'
api="https://#{account}.presentlyapp.com/api/twitter/statuses/update.xml"
itunes = OSA.app("iTunes")
@brianjlandau
brianjlandau / gist:176754
Created August 28, 2009 02:59 — forked from defunkt/gist:162444
Rails Capistrano deploy using git as our deployment strategy. You'll need git version >=1.5.6.6 on your server for this to work.
# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current # this tells capistrano where to run the migration. otherwise it would try to use the latest release directory (/path/to/app/releases/2012XXXXXXXXX)
set :use_sudo, false
set :ssh_options, {:forward_agent => true} # so you can checkout the git repo without giving the server access to the repo
set :rails_env, 'production'
# These are here to override the defaults by cap
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@eric
eric / newrelic_thinking_sphinx.rb
Created October 26, 2009 21:41
NewRelic instrumentation for ThinkingSphinx
# NewRelic instrumentation for ThinkingSphinx
if defined? ActiveRecord
ActiveRecord::Base.class_eval do
class << self
add_method_tracer :search, 'ActiveRecord/#{self.name}/search'
add_method_tracer :search, 'ActiveRecord/search', :push_scope => false
add_method_tracer :search, 'ActiveRecord/all', :push_scope => false
add_method_tracer :search_count, 'ActiveRecord/#{self.name}/search_count'
add_method_tracer :search_count, 'ActiveRecord/search_count', :push_scope => false
#!/usr/bin/ruby
require 'rubygems'
require 'tinder'
load "#{ENV['HOME']}/.campfire_status"
msg = "[#{USER_NAME} @ #{Time.now.strftime('%I:%M%p')}] #{ARGV.join(' ')}"
campfire = Tinder::Campfire.new(CAMPFIRE_SITE)
campfire.login(CAMPFIRE_EMAIL, CAMPFIRE_PASSWORD)
# on Start
do shell script "~/bin/set_campfire_status.rb \"Starting Pomodoro '$pomodoroName'\""
# on End
do shell script "~/bin/set_campfire_status.rb \"Pomodoro '$pomodoroName' ended\""
# on Reset
do shell script "~/bin/set_campfire_status.rb \"Pomodoro '$pomodoroName' ended (reset)\""
# install git
# install heroku ruby gem
# now, clone the github_twitter_server project
git clone git://github.com/technoweenie/github_twitter_server.git
cd github_twitter_server
# create a free heroku app
heroku create USER-gh-twitter
@jnunemaker
jnunemaker / mongo_mapper_new_relic.rb
Created January 8, 2010 09:04
MongoMapper NewRelic Integration
# Have to use ActiveRecord so that New Relic shows it on all graphs.
# The push scope false stuff makes it so that you can track usage by model and overall.
if defined?(NewRelic)
module MongoMapperNewRelic
def self.included(model)
mm_class_methods = [
:find,
:find!,
:paginate,
:first,
# Hook our MongoMapper model into Solr
module MongoAdapter
class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
def id
@instance.id
end
end
class DataAccessor < Sunspot::Adapters::DataAccessor
def load(id)
require "resque"
require "resque/failure/multiple"
require "resque/failure/redis"
# Configure Resque connection from config/redis.yml. This file should look
# something like:
# development: localhost:6379
# test: localhost:6379:15
# production: localhost:6379
Resque.redis = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env]