Skip to content

Instantly share code, notes, and snippets.

View maxdemarzi's full-sized avatar
🏠
Working from home

Max De Marzi maxdemarzi

🏠
Working from home
View GitHub Profile
@maxdemarzi
maxdemarzi / anees_haider.rb
Created November 22, 2010 07:00
Test Traversal
#<- "POST /db/data/node/6227/traverse/node HTTP/1.1\r\nContent-Type: application/json\r\nConnection: close\r\nHost: localhost:7474\r\nContent-Length: 567\r\n\r\n"
#<- "{\"order\":\"breadth first\",\"uniqueness\":\"node global\",\"relationships\":{\"type\":\"linked\",\"direction\":\"out\"},\"prune evaluator\":{\"language\":\"javascript\",\"body\":\"position.startNode().hasProperty('NODE_LEVEL') && position.startNode().getProperty('NODE_LEVEL')==5 && position.startNode().getId()!=6227;\"},\"return filter\":{\"language\":\"javascript\",\"body\":\"position.endNode().hasProperty('NODE_LEVEL') && position.endNode().getProperty('NODE_LEVEL')==5;\"}}"
require 'rubygems'
require 'neography'
# require 'net-http-spy'
# Net::HTTP.http_logger_options = {:verbose => true} # see everything
@maxdemarzi
maxdemarzi / Gemfile
Created March 21, 2012 18:02
Break Lucene - Public
source 'http://rubygems.org'
gem 'rake'
gem 'neography'
require 'bunny'
connection = Bunny.new
connection.start
channel = connection.create_channel
channel.prefetch(3)
exchange = channel.direct("moar")
@maxdemarzi
maxdemarzi / gist:6286700
Created August 20, 2013 20:17
Size + Time Rabbit MQ Accumulator
require 'bunny'
require 'timers'
TIME_TO_WAIT=3
MAX_BUFFER=3
# Setup Timers
timers = Timers.new
@three_second_timer = timers.every(3) { puts "***********triggered by timer*********" ; process_messages }
@maxdemarzi
maxdemarzi / GlobalUnique.java
Created December 21, 2013 15:08
Test running for 60 seconds, after 2x warm-ups: Using OpenBitSet: 265 requests, 4/s, mean 1831ms. Using HashSet: 173 requests, 3/s, mean 2807ms.
/**
* Copyright (c) 2002-2013 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@maxdemarzi
maxdemarzi / results
Last active January 4, 2016 07:28
TX 3 taking forever
Maxs-MacBook-Pro-2:neography maxdemarzi$ ruby transaction_test.rb
2014-01-23 16:45:47 -0600
2014-01-23 16:45:47 -0600 start
Error deleting: Neography::NotFoundException
2014-01-23 16:45:54 -0600
all nodes deleted
2014-01-23 16:45:54 -0600
creating nodes
2014-01-23 16:45:54 -0600
2014-01-23 16:45:54 -0600 tx start
@maxdemarzi
maxdemarzi / mh_spec.rb
Created January 26, 2014 22:44
Spatial
require 'spec_helper'
describe Neography::Rest do
before(:each) do
@neo = Neography::Rest.new
end
describe "the spatial plugin works" do
it "better work" do
node = @neo.create_node({:lat => 60.1, :lon => 15.2})
@maxdemarzi
maxdemarzi / MyService.java
Created March 23, 2014 05:49
NeoLove Service in Java
package org.neo4j.example.unmanagedextension;
import org.codehaus.jackson.map.ObjectMapper;
import org.neo4j.cypher.javacompat.ExecutionEngine;
import org.neo4j.cypher.javacompat.ExecutionResult;
import org.neo4j.graphdb.*;
import org.neo4j.helpers.collection.IteratorUtil;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@maxdemarzi
maxdemarzi / MyService.java
Created March 23, 2014 16:19
Neo Loves Caching
package org.neo4j.example.unmanagedextension;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.codehaus.jackson.map.ObjectMapper;
import org.neo4j.graphdb.*;
import org.neo4j.helpers.collection.IteratorUtil;
import javax.ws.rs.GET;
@maxdemarzi
maxdemarzi / pipeline_test.rb
Created April 11, 2014 15:06
Can't get more than 6000 r/s
require 'net/http/pipeline'
def runit
Net::HTTP.start 'localhost', 7474 do |http|
http.pipelining = true
reqs = []
6000.times do