Right now, this assumes you are using Snow Leopard.
Homebrew is MacPorts (or APT) without the suck. http://github.com/mxcl/homebrew
Right now, this assumes you are using Snow Leopard.
Homebrew is MacPorts (or APT) without the suck. http://github.com/mxcl/homebrew
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
| # - a browser with WebSocket support | |
| # | |
| # Usage: | |
| # ruby redis_pubsub_demo.rb | |
| # |
| #!/bin/sh | |
| # | |
| # init.d script for single or multiple unicorn installations. Expects at least one .conf | |
| # file in /etc/unicorn | |
| # | |
| # Modified by jay@gooby.org http://github.com/jaygooby | |
| # based on http://gist.github.com/308216 by http://github.com/mguterl | |
| # | |
| ## A sample /etc/unicorn/my_app.conf | |
| ## |
| Prototype mysql_grant provider for Chef | |
| --------------------------------------- | |
| Drop the two files into your mysql cookbook, and experiment with the following examples: | |
| mysql_grant "kenneth" do | |
| action :grant | |
| username "root" # <- User with admin privs | |
| password node[:mysql][:server_root_password] | |
| # Actual grant details |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
| require "fiber" | |
| require "rack/fiber_pool" | |
| require "sinatra/base" | |
| require "redis" | |
| require "redis/connection/synchrony" | |
| class App < Sinatra::Base | |
| use Rack::FiberPool |
| require 'goliath' | |
| require 'em-synchrony/em-http' | |
| class TwilioResponse < Goliath::API | |
| use Goliath::Rack::Params | |
| use Goliath::Rack::JSONP | |
| HEADERS = { authorization: ENV.values_at("TWILIO_SID","TWILIO_AUTH_TOKEN") } | |
| BASE_URL = "https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_SID']}/AvailablePhoneNumbers/US" |
| # Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference. | |
| # The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2 | |
| # Step 0: Check what is going on at port 80 | |
| $ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c | |
| # Step 1: Increase the number of available fds | |
| $ ulimit -n 32000 | |
| # Step 2: Restart your webserver, for me: |
Fibur is a library that allows concurrency during Ruby I/O operations without needing to make use of callback systems. Traditionally in Ruby, to achieve concurrency during blocking I/O operations, programmers would make use of Fibers and callbacks. Fibur eliminates the need for wrapping your I/O calls with Fibers and a callback. It allows you to write your blocking I/O calls the way you normally would, and still have concurrent execution during those I/O calls.
Say you have a method that fetches data from a network resource: