Skip to content

Instantly share code, notes, and snippets.

View boggle's full-sized avatar

Stefan Plantikow boggle

  • neo4j
  • Berlin, Germany
View GitHub Profile
/**
* Dynamic Pattern Matching in the spirit of
* Geller Hirschfeld Bracha 2010
*
* @author Stefan Plantikow <[email protected]>
*/
package be.bolder.dymatch
/**
@boggle
boggle / EvilEx.java
Created October 28, 2010 17:21
attempt at runtime type system breakage w exceptions
public final class EvilEx {
public final static class Complain extends Throwable {
}
private static Throwable[] _complain = { new Complain() };
static void complain() throws Exception {
System.out.println("I fart in your general direction");
throw ((Exception[])_complain)[0];
}
@boggle
boggle / doforme.js
Created February 10, 2011 12:02
Forays into chowning with sys.exec from node.js; no authentication
var express = require('express');
var app = express.createServer();
var process = require('child_process');
// Simple server configuration variables
var execDir = "/tmp";
var bufCap = 32768;
@boggle
boggle / gist:2000440
Created March 8, 2012 11:01
Use nailgun

I tried to use nailgun which is supposed to speedup jruby usage by sharing a single jvm over multiple jruby instances. It all seems to be a bit broken but this is what works for me:

In .rvmrc change --1.9 to --Xcompat.version=1.9 to avoid a stupid bug

Run jruby --ng-server in one terminal

Now env JRUBY_OPTS="$JRUBY_OPTS --ng" bundle exec rake spec

should give you somewhat better startup time (factor 2 for me).

@boggle
boggle / gist:2029943
Created March 13, 2012 17:05
first usable output from neoscout
{"nodes":{
"users":{
"properties":{
"type":{
"relevant":true,
"count":[6, 0, 6]
},
"name":{
"relevant":true,
"count":[6, 0, 6]
NativeException - org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[153314522] not in use:
org/neo4j/kernel/impl/nioneo/store/PropertyStore.java:494:in `getRecord'
org/neo4j/kernel/impl/nioneo/store/PropertyStore.java:359:in `getLightRecord'
org/neo4j/kernel/impl/nioneo/xa/ReadTransaction.java:184:in `getPropertyRecordChain'
org/neo4j/kernel/impl/nioneo/xa/ReadTransaction.java:214:in `loadProperties'
org/neo4j/kernel/impl/nioneo/xa/ReadTransaction.java:232:in `relLoadProperties'
org/neo4j/kernel/impl/persistence/PersistenceManager.java:121:in `loadRelProperties'
org/neo4j/kernel/impl/core/NodeManager.java:767:in `loadProperties'
org/neo4j/kernel/impl/core/RelationshipImpl.java:77:in `loadProperties'
org/neo4j/kernel/impl/core/Primitive.java:566:in `ensureFullProperties'
@boggle
boggle / gist:2500585
Created April 26, 2012 16:01
Nice way to add reloading support to a ruby gem's top-level module
module Foo
def self.files
f = []
f << 'foo/a'
f << 'foo/b'
f
end
def self.load_relative(f)
@boggle
boggle / rewrite.scala
Created January 29, 2013 18:16
Solving AST typing riddles
trait Rewriter[T] extends {
def rewrite[X <: T](a: Rewritable[X]): Rewritable[X]
}
trait Rewritable[T] {
self: T with Rewritable[T] =>
def rewrite(r: Rewriter[T]): T = r.rewrite[T](self).reveal
def reveal: T = self
package org.neo4j.cypher.performance
import org.junit.Test
class ScalaStreamTest {
@Test def stream_append_should_use_linear_memory() {
def streamAppendTimes(times: Int): Float =
{
"/Users/stepn/Current/neo4j/manual/target/tools/bin/asciidoc/asciidoc.py" --attribute neo4j-version=2.0-SNAPSHOT --attribute gitversion=master --attribute importdir="/Users/stepn/Current/neo4j/manual/target/docs" --conf-file="/Users/stepn/Current/neo4j/manual/target/conf/asciidoc.conf" --conf-file="/Users/stepn/Current/neo4j/manual/target/conf/asciidoc.local.conf" --backend html5 --doctype book --attribute docinfo1 --attribute toc --out-file "/Users/stepn/Current/neo4j/manual/target/html5/index.html" "/Users/stepn/Current/neo4j/manual/target/src/neo4j-manual.asciidoc" 2>&1 | "/Users/stepn/Current/neo4j/manual/target/tools/build/outputcheck-includefiles.sh" || false
Traceback (most recent call last):
File "/Users/stepn/.asciidoc/filters/queryresult/queryresult.py", line 120, in <module>
if data[0][0] == '+':
IndexError: list index out of range
asciidoc: WARNING: union-union-two-queries.result.asciidoc: line 5: filter non-zero exit code: "/usr/bin/python" "/Users/stepn/.asciidoc/filters/queryresult/quer