Skip to content

Instantly share code, notes, and snippets.

View rsanheim's full-sized avatar

Rob Sanheim rsanheim

View GitHub Profile
@rsanheim
rsanheim / gist:2852
Created July 28, 2008 06:47
stupid simple backup script
#!/usr/bin/env ruby
# Stupid simple rsync backup script
# The first arg is an optional bandwidth limit, and the second is an optional --v (verbose) flag
def run_cmd_with_live_stdout(cmd)
$stdout.sync = true
STDOUT.sync = true
IO.popen(cmd) do |is|
until is.eof?
# This gets mocha and bacon playing together, but there needs to be a hack in mocha as well
# See the open issue here:
# http://groups.google.com/group/mocha-developer/browse_thread/thread/2ac239561ef07b23
require 'bacon'
require "mocha/standalone"
require "mocha/object"
class Bacon::Context
include Mocha::Standalone
def initialize(name, &block)
require File.dirname(__FILE__) + '/../unit_test_helper'
describe "REXML" do
it "handles DOS vulnerability" do
# From http://p.ramaze.net/1887
dom = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE member [
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
<!ENTITY b "&c;&c;&c;&c;&c;&c;&c;&c;&c;&c;">
[build@rcr-buildpub01 rspec]$ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]
[build@rcr-buildpub01 rspec]$ gem list
*** LOCAL GEMS ***
actionmailer (2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.3.6)
actionpack (2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.13.6)
actionwebservice (1.2.6)
# module: audit2
class Audit < Thor
desc "all", "Run all audit tasks"
def all
%w(architecture database stats tests coverage flog roodi filesize queries).each do |task|
log "\n*** reviewing #{task}", true
log `thor audit:#{task}`, true
end
end
(in /Users/rsanheim/src/oss/dm-core)
......*...................................................................**........*..................*...................*....*.........................................................................................*............................................................*........................*...............*............................................................*........................*..............................................*..........**.............******...***...*******..............................................................................................................................................................................................................*...................................................*****....*.......................................................................*.............................................F.................................................*.................................................
rsanheim@ares:~/src/relevance/obsidian (master)$ rake
(in /Users/rsanheim/src/relevance/obsidian)
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
/opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:147:in `activate': can't activate activesupport (= 2.1.1, runtime), already activated activesupport-2.1.2 (Gem::Exception)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:163:in `activate'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:162:in `each'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:162:in `activate'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
from ./test/test_helper.rb:6
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
** [out :: [email protected]]
** [out :: [email protected]] Setting up xsltproc (1.1.22-1ubuntu1) ...
** [out :: [email protected]] Processing triggers for libc6 ...
** [out :: [email protected]] ldconfig deferred processing now taking place
*** [err :: [email protected]] E:
*** [err :: [email protected]] Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/glib2.0/libglib2.0-0_2.16.3-1ubuntu3_i386.deb: 404 Not Found [IP: 91.189.88.31 80]
*** [err :: [email protected]]
** [out :: [email protected]] Reading package lists...
** [out :: [email protected]]
** [out :: [email protected]] Building dependency tree...
(in /Users/rsanheim/src/oss/rspec)
Profiling enabled.
.........................................................................................................................................................................................................................................................................*.....*......................*....................................................*...............................................................................................................................................................................................................................................................................................................................................................*............................................................................................................................................................................................................................................................................
gem 'rspec'
require 'spec'
describe "something" do
after { puts "i run!" }
it 'fails' do
1.should == 2
end
end