Skip to content

Instantly share code, notes, and snippets.

@rurounijones
rurounijones / gist:1604031
Created January 13, 2012 00:40
Nokogiri est failures
jjones@jjones-desktop:~/Projects/nokogiri/nokogiri$ ../jruby-1.6.5.1/bin/jruby -S rake
(in /home/jjones/Projects/nokogiri/nokogiri)
install -c tmp/java/nokogiri/nokogiri.jar lib/nokogiri/nokogiri.jar
/home/jjones/Projects/nokogiri/nokogiri/../jruby-1.6.5.1/bin/jruby -w -I.:lib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_memory_leak.rb"; require "test/test_encoding_handler.rb"; require "test/test_convert_xpath.rb"; require "test/test_nokogiri.rb"; require "test/test_xslt_transforms.rb"; require "test/test_css_cache.rb"; require "test/test_reader.rb"; require "test/test_soap4r_sax.rb"; require "test/xslt/test_exception_handling.rb"; require "test/xslt/test_custom_functions.rb"; require "test/html/test_named_characters.rb"; require "test/html/test_node_encoding.rb"; require "test/html/test_node.rb"; require "test/html/test_builder.rb"; require "test/html/test_document_encoding.rb"; require "test/html/test_document_fragment.rb"; require "test/html/test_document.rb"; require "
@rurounijones
rurounijones / test.rb
Created January 13, 2012 10:37
JMuPDF BufferedImage color problem
require 'java'
require 'lib/jmupdf.jar'
java_import com.jmupdf.pdf.PdfDocument
java_import com.jmupdf.exceptions.DocException;
java_import com.jmupdf.exceptions.DocSecurityException;
java_import com.jmupdf.page.Page;
java_import com.jmupdf.page.PageRenderer;
java_import java.awt.image.BufferedImage;
@rurounijones
rurounijones / initializer-monkey-patch.rb
Created January 20, 2012 00:35
Mongoid monkey-patching
# Monkey-patch the mongo ruby driver to expose socket information so that we can
# interrogate it for port information
module Mongo
class Pool
def sockets
@sockets
end
end
end
@rurounijones
rurounijones / log
Created February 6, 2012 07:04
JRuby build failure - Ubuntu 10.04
build-jruby-cext-native:
[exec] make[1]: Entering directory `/home/jjones/jruby-1.6.6/cext/src'
[exec] cc -m64 -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing -W -Wall -Wno-unused -Wno-parentheses -Werror -Wundef -I"/home/jjones/jruby-1.6.6/cext/src/../..//build" -I"/home/jjones/jruby-1.6.6/cext/src" -I"/home/jjones/jruby-1.6.6/cext/src/../..//build"/jni -I"/home/jjones/jruby-1.6.6/cext/src"/include -I"/home/jjones/jruby-1.6.6/cext/src"/include/ruby -fPIC -I"/usr/include" -I"/usr/include/linux" -D_REENTRANT -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -pthread -c /home/jjones/jruby-1.6.6/cext/src/st.c -o /home/jjones/jruby-1.6.6/cext/src/../..//build/st.o
[exec] In file included from /usr/include/sys/select.h:46,
[exec] from /usr/include/sys/types.h:220,
[exec] from /home/jjones/jruby-1.6.6/cext/src/include/ruby/ruby.h:18,
[exec] from /home/jjones/jruby-1.6.6/cext/src/include/ruby.h:2,
[exec] from /home/jjones
@rurounijones
rurounijones / server.log
Created February 7, 2012 01:16
Torquebox debug log
10:11:43,425 DEBUG [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) Deployment scan of [C:\torquebox-current\jboss\standalone\deployments] found update action [{
"operation" => "composite",
"address" => undefined,
"steps" => [
{
"operation" => "add",
"address" => [("deployment" => "test01-knob.yml")],
"content" => [{
"path" => "deployments/test01-knob.yml",
"relative-to" => "jboss.server.base.dir",
@rurounijones
rurounijones / results
Created February 7, 2012 09:19
Ruby FFI shennanigans
$ rvm current
ruby-1.9.3-p0
$ ruby test.rb
Input: 'Test テスト 文字調査', UTF-8
Output: 'Test テスト 文字調査', ASCII-8BIT
$ rvm current
jruby-1.6.6
$ ruby --1.9 test.rb
Input: 'Test テスト 文字調査', UTF-8
@rurounijones
rurounijones / example.cpp
Created February 27, 2012 00:14
Datalogics C++ Example
/* Copyright 2007 Datalogics, Inc. All rights reserved.
This program tests the PDF2IMG C API functionality for reading PDFs
from blocks of memory and writing PDFs to blocks of memory. Posted got this Gist with permission
*/
#include "pdf2imglib.h"
#include <math.h>
#include <stdio.h>
@rurounijones
rurounijones / gist:2326019
Created April 7, 2012 06:51
Roomba Positioning
def initialize(port, latency=0, baud=115200)
# baud must be 115200 for communicating with 500 series Roomba and newer (tested with Roomba 770), change to 57600 for 400 series and older
@serial = SerialPort.new(port, baud, 8, 1, SerialPort::NONE)
@latency = latency
# We will assume these are the positions and directions of the Roomba when
# initially docked
@x = 0
@y = 0
@facing = 0
Started DELETE "/users/rurounijones" for 127.0.0.1 at 2012-05-03 05:44:43 +0900
Processing by UsersController#destroy as HTML
Parameters: {"authenticity_token"=>"FTFV0iNtTJSvhdp1I5q++p2SDQxgcbEkItXL242YCbI=", "id"=>"rurounijones"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."nickname" = 'rurounijones' LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."nickname" = 'rurounijones' LIMIT 1
(0.1ms) BEGIN
(0.1ms) ROLLBACK
-----------------------------------------------
@rurounijones
rurounijones / gist:2698969
Created May 15, 2012 03:49
Torquebox Stacktrace
12:42:29,598 INFO [Castor] (http-localhost-127.0.0.1-8080-4) Processing by DsmSetsController#show as JPG
12:42:29,600 INFO [Castor] (http-localhost-127.0.0.1-8080-3) Processing by DsmSetsController#show as JPG
12:42:29,600 INFO [Castor] (http-localhost-127.0.0.1-8080-3) Parameters: {"set"=>{"text"=>"Testing23", "width"=>"800"}, "key"=>"bdSFBUxfa1EVAWCWWvBr", "id"=>"4ee58f848625ee2cc2000004"}
12:42:29,602 INFO [Castor] (http-localhost-127.0.0.1-8080-4) Parameters: {"set"=>{"text"=>"Testing23", "width"=>"800"}, "key"=>"bdSFBUxfa1EVAWCWWvBr", "id"=>"4ee58f848625ee2cc2000003"}
12:42:29,614 INFO [Castor] (http-localhost-127.0.0.1-8080-8) Processing by DsmSetsController#show as JPG
12:42:29,614 INFO [Castor] (http-localhost-127.0.0.1-8080-8) Parameters: {"set"=>{"text"=>"Testing23", "width"=>"800"}, "key"=>"bdSFBUxfa1EVAWCWWvBr", "id"=>"4ee58f848625ee2cc2000008"}
12:42:29,616 INFO [Castor] (http-localhost-127.0.0.1-8080-2) Processing by DsmSetsController#show as JPG
12:42:29,617 INFO [Castor] (http-lo