This file contains 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/ruby | |
filename = $*[0] | |
lines = {} | |
puts "Comparing #{filename}" | |
File.open(filename, "r") do |f| | |
while (line=f.gets) do | |
line = line.downcase.gsub(/\n/, '') | |
lines[line] ||= 0 | |
lines[line] += 1 |
This file contains 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
require 'rubygems' | |
require 'json' | |
require 'sinatra' | |
File.open('whois_proxy.pid', 'w') { |f| f.write(Process.pid) } | |
get '/whois/:tld/:domain' do | |
domain = (params['domain'] || '').gsub(/[^a-zA-Z0-9\-\_]/, '') | |
tld = (params['tld'] || '').gsub(/[^a-zA-Z0-9\-\_]/, '') | |
available = false |
This file contains 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
def has_gem?(name, version=nil) | |
if !$GEM_LIST | |
gems = {} | |
`gem list --local`.each_line do |line| | |
gems[$1.to_sym] = $2.split(/, /) if line =~ /^(.*) \(([^\)]*)\)$/ | |
end | |
$GEM_LIST = gems | |
end | |
if $GEM_LIST[name.to_sym] | |
return version ? $GEM_LIST[name.to_sym].include?(version) : true |
This file contains 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
HotCocoa::Mappings.map :gl_view => :NSOpenGLView do | |
defaults :frame => DefaultEmptyRect, | |
:layout => {} | |
constant :auto_resize, { | |
:none => NSViewNotSizable, | |
:width => NSViewWidthSizable, | |
:height => NSViewHeightSizable, |
This file contains 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
set :mongrel_base_port, 5000 | |
set :mongrel_restart_delay, 30 | |
set :mongrel_count, 2 | |
namespace :mongrel do | |
task :restart, :roles => [:app], :except => {:mongrel => false} do | |
(mongrel_base_port..(mongrel_base_port+mongrel_count)).to_a.each do |port| | |
sudo "/usr/bin/monit restart mongrel_#{monit_group}_#{port}" | |
sleep mongrel_restart_delay | |
end |
This file contains 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
location / { | |
include /etc/nginx/common/proxy.conf; | |
if (-f $document_root/system/cache$uri.html) { | |
rewrite ^(.*)$ /system/cache$1.html; | |
break; | |
} | |
if (-f $document_root/system/cache$uri/index.html) { | |
rewrite ^(.*)$ /system/cache$1/index.html; |
This file contains 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
>> m = Rails.cache.instance_eval("@data") | |
=> <MemCache: 3 servers, ns: nil, ro: false> | |
>> t = Time.now.to_f; m.get('a'); puts "#{Time.now.to_f - t}" | |
0.000349998474121094 | |
=> nil | |
>> t = Time.now.to_f; Rails.cache.read('b'); puts "#{Time.now.to_f - t}" | |
0.0184650421142578 | |
=> nil | |
>> 0.0184650421142578 / 0.000349998474121094 | |
=> 52.7574931880108 |
This file contains 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 Foo::BarsController < ApplicationController | |
def create | |
out = "Params: #{params.inspect}" | |
out << "\nrack.uploads: #{request.env['rack.uploads'].inspect}" | |
logger.info out | |
render :text => out | |
end | |
end | |
This file contains 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
ERROR: mount[/blogage] (/var/chef/cookbooks/nfs_mount/recipes/default.rb line 12) had an error: | |
Device node:/shares/blogage-production does not exist | |
/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/provider/mount/mount.rb:43:in `load_current_resource'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:55:in `build_provider'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:86:in `converge'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `each'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `converge'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:58:in `each'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:57:in `each'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:63:in `converge'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:373:in `converge'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:101:in `run_solo'/usr/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/solo.rb:122:in `run_appli |
This file contains 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/env ruby | |
ARGV.each do |file| | |
data = File.read(file) | |
if data | |
if data =~ /\A\#\!ruby19/ | |
exit | |
else | |
puts "1.9ifying #{file}" | |
File.open(file, "w") do |f| |
OlderNewer