Skip to content

Instantly share code, notes, and snippets.

View look's full-sized avatar

Luke Francl look

View GitHub Profile
# an example Monit configuration file for collectiveidea's fork of delayed_job.
# See: http://stackoverflow.com/questions/1226302/how-to-monitor-delayedjob-with-monit/1285611
#
# To use:
# 1. replace {app_name} and {environment} as appropriate
# 2. copy to your repository under config/delayed_job.monitrc
# 3. add this to your /etc/monit/monitrc:
#
# include /var/www/apps/{app_name}/current/config/*.monitrc
# 4. reload monit when you deploy to pick up any changes to your monitrc files: sudo monit reload
module Sunspot
class Setup
def more_like_this=(fields)
@more_like_this = fields
end
def more_like_this
@more_like_this || []
end
end
desc "Deploy to Heroku. Pass APP=appname to deploy to a different app"
task :deploy do
require 'heroku'
require 'heroku/command'
user, pass = File.read(File.expand_path("~/.heroku/credentials")).split("\n")
heroku = Heroku::Client.new(user, pass)
cmd = Heroku::Command::BaseWithApp.new([])
remotes = cmd.git_remotes(File.dirname(__FILE__) + "/../..")
# Convert a Gemfile to Heroku's .gems file plus config.gem statements for Rails 2.3
herokuconfig = ""
railsconfig = ""
gemfile = File.new("Gemfile")
gemfile.readlines.each do |line|
if line =~ /gem ['"](\w+)['"](?:, ['"](.+?)['"]){0,1}(?:, :require => ['"](.+?)['"]){0,1}/
herokuconfig << "#{$1}" + ($2 ? %Q( --version "#{$2}") : '') + "\n"
railsconfig << "config.gem '#{$1}'" + ($2 ? ", :version => '#{$2}'" : '') + ($3 ? ", :lib => '#{$3}'" : '') + "\n"
#
# Silently fail instead of raising an exception when an error occurs while writing to Solr.
# NOTE: does not fail for reads; you should catch those exceptions, for example in a rescue_from statement.
#
# To configure, add this to an initializer:
# Sunspot.session = SilentFailSessionProxy.new(session_or_proxy)
#
# You can get the existing session with Sunspot.send(:session) (it's a private method in Sunspot 0.18, but not 1.0)
#
# This is for Sunspot 0.18 and would need to be changed a little bit for Sunspot 1.0.
@look
look / app.yaml
Created January 24, 2011 23:59 — forked from dound/app.yaml
application: yourappid
version: testgaesessions
runtime: python
api_version: 1
handlers:
- url: /stats.*
script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py
- url: /.*
script: main.py
@look
look / README.md
Last active May 28, 2019 07:06 — forked from milroc/README.md
Sunrise, sunset

Sunrise and sunset time visualization for Minneapolis, Minnesota. Adapted from D3 for Mere Mortals.