Skip to content

Instantly share code, notes, and snippets.

require 'uri'
require 'net/http'
require 'hpricot'
html = Net::HTTP.get(URI.parse(THE_JIRA_URL))
doc = Hpricot(html)
doc.search("//*[@id='issuetable']")
@atoulme
atoulme / collect_build_info_from_jenkins.rb
Created April 9, 2011 01:06
A simple script to grab the info about the last build on jenkins/hudson, take apart the XML and expose it as a Ruby object
require 'uri'
require 'net/http'
require 'rexml/document'
class BuildInfo
def self.getLastBuildInfo(server, job_name, username, password)
resp = nil
Net::HTTP.start(server) {|http|
req = Net::HTTP::Get.new("/job/#{job_name}/lastBuild/api/xml")
@atoulme
atoulme / changes_in_git_repo.sh
Created April 7, 2011 04:54
A simple function for Bash to recognize if there have been changes in a git repository's remote master compared to the local checked out branch.
function changes_in_git_repo () {
latestlocal=`git rev-parse HEAD`;
echo $latestlocal
gitrepourl=`git remote -v | grep fetch | awk '{print $2}'`;
echo $gitrepourl;
latestremote=`git ls-remote --heads $gitrepourl master| awk '{print $1}'`;
echo $latestremote;
if [ $latestlocal != $latestremote ]
#!/usr/bin/env ruby
# Input: WordPress XML export file.
# Outputs: a series of Textile files ready to be included in a Jekyll site,
# and comments.yml which contains all approved comments with metadata which
# can be used for a Disqus import.
require 'rubygems'
require 'hpricot'
require 'clothred'
WARN [1163789880@qtp-716941846-0 - /] 2010-08-18 19:29:21,561 Responder.java (line 140) system error
org.apache.avro.AvroRuntimeException: Not in union ["string",{"type":"error","name":"InvalidRequestException","namespace":"org.apache.cassandra.avro","fields":[{"name":"why","type":["string","null"]}]}]: java.lang.NullPointerException
at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:340)
at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:67)
at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:55)
at org.apache.avro.specific.SpecificResponder.writeError(SpecificResponder.java:81)
at org.apache.avro.ipc.Responder.respond(Responder.java:137)
at org.apache.avro.ipc.ResponderServlet.doPost(ResponderServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
def test_system_column_family_operations(self):
self.__set_keyspace('Keyspace1')
columnDef = dict()
columnDef['name'] = b'ValidationColumn'
columnDef['validation_class'] = 'BytesType'
#cfDef = CfDef('Keyspace1', 'NewColumnFamily', column_metadata=[cd])
cfDef = dict()
cfDef['keyspace'] = 'Keyspace1'
19:27:14~/w/git/cassandra:trunk*>nosetests test/system/test_avro_server.py
..........E
======================================================================
ERROR: system.test_avro_server.TestRpcOperations.test_system_column_family_operations
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/case.py", line 186, in runTest
self.test(*self.arg)
File "/Users/antoine/w/git/cassandra/test/system/test_avro_server.py", line 343, in test_system_column_family_operations
self.client.request('system_add_column_family', {'cf_def' : cfDef})
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
C:\Users\vanto\dev\git\pxe>jruby -rrbconfig -e "p Config::CONFIG"
{"MAJOR"=>"1", "MINOR"=>"8", "TEENY"=>"7", "ruby_version"=>"1.8", "arch"=>"universal-java1.6", "bindir"=>"C:/local/buildr-1.4.0/bin", "RUBY_INSTALL_NAME"=>"jruby", "ruby_install_name"=>"jruby", "SHELL"=>"cmd.exe", "prefix"=>"C:\\local\\buildr-1.4.0", "exec_prefix"=>"C:\\local\\buildr-1.4.0", "host_os"=>"mswin32", "host_vendor"=>"Sun Microsystems Inc.", "host_cpu"=>"x86", "target_os"=>"mswin32", "target_cpu"=>"x86", "LIBRUBY"=>"jruby.jar", "LIBRUBY_SO"=>"jruby.jar", "build"=>"java1.5", "target"=>"java1.5", "libdir"=>"C:/local/buildr-1.4.0/lib", "rubylibdir"=>"C:/local/buildr-1.4.0/lib/ruby/1.8", "sitedir"=>"C:/local/buildr-1.4.0/lib/ruby/site_ruby", "sitelibdir"=>"C:/local/buildr-1.4.0/lib/ruby/site_ruby/1.8", "sitearchdir"=>"C:/local/buildr-1.4.0/lib/ruby/site_ruby/1.8/java", "archdir"=>"C:/local/buildr-1.4.0/lib/ruby/1.8/java", "topdir"=>"C:/local/buildr-1.4.0/lib/ruby/1.8/java", "configure_args"=>"", "datadir"=>"C:/local/buildr-1.4.0/share",
To repro:
get the vanity head
git clone http://github.com/assaf/vanity.git
then install gems:
gem install rails redis redis-namespace sqlite3-ruby timecop mocha passenger
then run rake test
(in /Users/antoine/w/git/vanity)
** Invoke test (first_time)
** Execute test