Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'net/http'
require 'rexml/document'
@cc_server = 'your-cc-server'
include REXML
def build_green?
result = Net::HTTP.start(@cc_server, 8000) { |http| http.get('/XmlStatusReport.aspx') }
# Installer script for the Android development environment on MacOSX.
# This code is Public Domain. Have fun.
# Made by @joakimk.
DOWNLOAD_DIR = "~/Downloads/android"
INSTALL_DIR = "/usr/local/android"
system "mkdir -p #{DOWNLOAD_DIR}"
def check(part)
print part.gsub(/_/, ' ').capitalize + " y/n: "; STDOUT.flush
@joakimk
joakimk / Testbot stats (for rspec)
Created January 26, 2010 19:21
Example test runtimes using testbot
1 computers - 1 cpus: 29 minutes (rake spec)
5 computers - 13 cpus: 4 minutes (rake testbot:spec)
10 computers - 25 cpus: 2 minutes (rake testbot:spec) (about 60% cpu efficiency)
The testbot communication overhead is about 2-5 seconds per run. Fetching the code
and setting up the test environment takes a bit longer. The jobs are not being
perfectly balanced. There is still plenty of room for optimizations.
#!/usr/bin/env ruby
CHANNEL = "#shrug_bots"
SERVER = 'irc.freenode.net'
PORT = 6667
NICK = 'notify'
PASS = ''
require "socket"
Stats for optimized parallel_specs spec-grouping.
Not much, but it's better.
Old sorting - Run #1
Process #1: Finished in 190.369665 seconds
Process #2: Finished in 196.368211 seconds
Real time: 3min 35sec.
Old sorting - Run #2
Bug?
The SchemaDumper in rails, which is used by rake db:schema:dump expects there to be either a
"pk_and_sequence_for" or "primary_key" on the connection adapter. See line 82:
http://github.com/rails/rails/blob/master/activerecord/lib/active_record/schema_dumper.rb#L82
However... the jdbcmysql adapter does not have either method. The result of this is that running
"jruby -S rake db:schema:dump" will create a schema.rb where every table has :id => false.
# .autotest in your project or ~/.autotest
# This reduces the time from when you save a file to when autotest runs the tests.
# Optimization: Quicker response time for the files you change more than once
class Autotest
alias_method :find_files_orig, :find_files
def find_files
result = {}
@recently_updated ||= []
...
/bin/sh ../../libtool --tag=CC --mode=link /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -O4 -march=core2 -mmmx -msse4.1 -pipe -Wall -L/usr/local/Cellar/gettext/0.17/lib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/iconv/lib/libiconv.a -framework Carbon -o buffered-input-stream buffered-input-stream.o ../../glib/libglib-2.0.la ../../gobject/libgobject-2.0.la ../../gio/libgio-2.0.la -lintl
libtool: link: /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -O4 -march=core2 -mmmx -msse4.1 -pipe -Wall -o .libs/g-icon g-icon.o -L/usr/local/Cellar/gettext/0.17/lib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/iconv/lib/libiconv.a ../../glib/.libs/libglib-2.0.dylib ../../gobject/.libs/libgobject-2.0.dylib ../../gio/.libs/libgio-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/gobject/.libs/libgobject-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/gmodule/.libs/libgmodule-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/glib/.libs/libglib-2.0.dylib -liconv -lintl -
# http://gist.github.com/gists/593755 (fork of http://gist.github.com/485785)
require 'spec/runner/formatter/progress_bar_formatter'
class FailuresDuringRunFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def example_failed(example, counter, failure)
super # show the 'F' in progress
dump_failure(counter, failure)
end
end
class Spec::Runner::Reporter
@joakimk
joakimk / pxe_server_install.sh
Created October 12, 2010 16:41
Script to install a PXE boot server for diskless clients
# This installs a PXE boot server.
#
# It's based on https://help.ubuntu.com/community/DisklessUbuntuHowto.
# It's been used with ubuntu-10.10-server-amd64.iso and ubuntu-10.10-server-i386.iso.
#
# It requires two network cards. One for access to the outside world and one
# for a private network of PXE clients. I've choosen this setup to not cause problems
# with DHCP on the normal network.
#
# It also requires that you have a second partition mounted on /nfsroot.