Skip to content

Instantly share code, notes, and snippets.

Joakim Kolsjö joakimk

Block or report user

Report or block joakimk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:89810
#!/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') }
View install_android.rb
# 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 Jan 26, 2010
Example test runtimes using testbot
View Testbot stats (for rspec)
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.
View notify.rb
#!/usr/bin/env ruby
CHANNEL = "#shrug_bots"
SERVER = 'irc.freenode.net'
PORT = 6667
NICK = 'notify'
PASS = ''
require "socket"
View gist:296903
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
View schema_dumper bug?
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.
View .autotest.rb
# .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 ||= []
View irssi build fail on snow leopard (brew)
...
/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 -
View failures_during_run_formatter.rb
# 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 Oct 12, 2010
Script to install a PXE boot server for diskless clients
View pxe_server_install.sh
# 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.
You can’t perform that action at this time.