Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Configuration manager</title>
<%= stylesheet_link_tag 'style' %>
<%= yield :head %>
</head>
<body>
<!--[if IE]><div class="ie"><![endif]--><!--[if lt IE 7.]><div class="ie6"><![endif]-->
<div id="layout">
#!/usr/bin/ruby
# adapted: http://snippets.dzone.com/posts/show/6242
# file: portscan.rb
require 'socket'
require 'timeout'
require File.expand_path(File.join(File.dirname(__FILE__),'progressbar.rb'))
require 'rubygems'
require 'hpricot'
diff --git a/ext/extconf.rb b/ext/extconf.rb
index 9b1db02..1a82c42 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -17,6 +17,17 @@ elsif !have_library('curl') or !have_header('curl/curl.h')
EOM
end
+# Check arch flags
+archs = $CFLAGS.scan(/-arch\s(.*?)\s/).first # get the first arch flag
ActionController::Base.class_eval do
class << self
# when content_for is called we need to know the rendering actions cache_path
def caches_action_with_content_for(*actions)
#puts("#{self.inspect}: caches_action: #{actions.inspect}")
options = actions.last
options = {} unless options.is_a?(Hash)
#puts("#{self.inspect}: cache_path: #{options[:cache_path].inspect}")
@action_caches ||= {}
actions[0..actions.size-2].each do|act|
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
doc = Hpricot.XML(File.read(ARGV[0]))
c = 0
File.open("urls.txt","w") do|f|
(doc/:url).each do|url|
# see: http://github.com/blog/517-unicorn
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 6 workers and 1 master
worker_processes (rails_env == 'production' ? 6 : 2)
# Load rails+app into the master before forking workers
# for super-fast worker spawn times
#!/usr/bin/env ruby
UNICORN_RAILS="/var/www/apps/ruby/bin/unicorn_rails".freeze
APP_PATH="/var/www/apps/jjsingh/current/".freeze
class Runner
class << self
def start
system "#{UNICORN_RAILS} -c #{APP_PATH}/config/unicorn.rb -E production -D"
require 'rubygems'
require 'curb'
def concat_to_file(urls,save_path)
downloads = {}
Curl::Multi.get(urls) {|easy| downloads[easy.url] = easy.body_str }
puts "saving #{urls.inspect} to #{save_path.inspect}"
File.open(save_path,"wb"){|f| urls.each {|url| f << downloads[url] } }
end
valgrind --leak-check=full --track-origins=yes --leak-resolution=high --num-callers=64 /home/taf2/rb19/bin/ruby tests/tc_curl_multi.rb
==17923== Memcheck, a memory error detector.
==17923== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==17923== Using LibVEX rev 1884, a library for dynamic binary translation.
==17923== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==17923== Using valgrind-3.4.1, a dynamic binary instrumentation framework.
==17923== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==17923== For more details, rerun with: -v
==17923==
Loaded suite tests/tc_curl_multi
### bugcheck.rb:
$TOPDIR = File.expand_path(File.join(File.dirname(__FILE__)))
$EXTDIR = File.join($TOPDIR, 'ext')
$LIBDIR = File.join($TOPDIR, 'lib')
$:.unshift($LIBDIR)
$:.unshift($EXTDIR)
require 'curb'
$count = 0