This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backports_apt_package.rb | |
# | |
# Resource and provider to correctly install packages from Debian's | |
# backports, which are a non-default apt source. Creates | |
# backports_apt_package resource which does the Right Thing. | |
# | |
# Drop this file into cookbook's libraries/ dir. | |
require 'chef/provider/package/apt' | |
require 'chef/resource/package' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Copyright : (c) SAEKI Yoshiyasu | |
# License : MIT-style license | |
# <http://www.opensource.org/licenses/mit-license.php> | |
# last updated: 2011/03/04 | |
from akka.actor import Actors, UntypedActor | |
# from akka.dispatch import Futures | |
import collections |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /etc/init.d/xvfb_daemon | |
# Xvfb startup script. | |
# Tom Meier <[email protected]> | |
# | |
### BEGIN INIT INFO | |
# Provides: xvfb | |
# Short-Description: Start/stop/restart daemon | |
# Description: Controls the Xvfb daemon which starts/stops the X Virtual Framebuffer server | |
### END INIT INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Rack configuration for use with Phusion Passenger. | |
# | |
# Updated with Blake's suggestions from: http://gist.github.com/98711 | |
log = File.new('log/sinatra.log', 'a') | |
$stdout.reopen(log) | |
$stderr.reopen(log) | |
require 'YOUR_APPLICATION' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[08:48 AM:gist-99771(master)] $ irb -rubygems -r myapp.rb -r rack/test | |
>> app = Rack::Test::Session.new(Sinatra::Application) | |
=> #<Rack::Test::Session:0x17e8820 @headers={}, @app=Sinatra::Application> | |
>> app.get '/' | |
=> #<Rack::Response:0x17ad4dc @block=nil, @writer=#<Proc:0x0189f7b4@/opt/local/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/response.rb:24>, header{"Content-Type"=>"text/html", "Content-Length"=>"7"}, body["testing"], length7, status200 | |
>> app.body | |
NoMethodError: undefined method `body' for #<Rack::Test::Session:0x17e8820> | |
from (irb):3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Arguments(val rawArgs:Array[String], val flagNames:Seq[String] = Seq()) { | |
import Arguments._ | |
val flags:Seq[Argument] = | |
rawArgs.intersect(flagNames).toList.map{ s => Flag(s) } | |
val values:Seq[Argument] = | |
rawArgs.diff(flags).grouped(2).toList.collect{ case Array(n,v) => Value(n,v)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Part Zero : 10:15 Saturday Night | |
* | |
* (In which we will see how to let the type system help you handle failure)... | |
* | |
* First let's define a domain. (All the following requires scala 2.8.x and scalaz 5.0) | |
*/ | |
import scalaz._ | |
import Scalaz._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SafeUnsafe { | |
def unsafe[T](x: =>T):Option[T]= | |
try { | |
Option(x) | |
} catch { | |
case _ => None | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
/** | |
* playing with some of the ideas from the Haskell fclabels library | |
* using the new Lens functionality in scalaz | |
* | |
* http://hackage.haskell.org/package/fclabels | |
*/ | |
object LensTest { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to | |
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls | |
# to the service and redirect them to unicorn directly. | |
# | |
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn. | |
# | |
function is_unicorn_alive { |