Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Max De Marzi maxdemarzi

🏠
Working from home
Block or report user

Report or block maxdemarzi

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 README.md

CALL com.maxdemarzi.similarity(0.90, 100)

@maxdemarzi
maxdemarzi / App.java
Created Apr 9, 2017
Jooby Rocker hot reload fails
View App.java
// Setup Template Engine
use(new Rockerby());
RockerRuntime.getInstance().setReloading(true);
@maxdemarzi
maxdemarzi / manifest.yml
Created May 19, 2016
Neo4j on Cloud Foundry
View manifest.yml
---
name: neo4j-deployment
director_uuid: 93c01d2d-a2a5-49d8-8d02-389fd223a9cf
releases:
- {name: neo4j, version: 2.3.3}
networks:
- name: my-network
type: vip
compilation:
workers: 1
@maxdemarzi
maxdemarzi / bolt2.groovy
Created Feb 16, 2016
test run bolt via grooby
View bolt2.groovy
@Grab("org.neo4j.driver:neo4j-java-driver:1.0-SNAPSHOT")
import org.neo4j.driver.v1.*
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Session session = driver.session();
//Result rs = session.run("cypher runtime=compiled MATCH (n:Foo)-[r:NEXT]->(m) RETURN n.id AS n,m.id AS m");
ResultCursor rs = session.run(" MATCH (n) WHERE ID(n) = 0 RETURN id(n) AS n");
@maxdemarzi
maxdemarzi / __usage.adoc
Last active Nov 20, 2019 — forked from jexp/__numbers_31.txt
Concurrent Neo4j Performance Tests via HTTP + Cypher (usage: ./_run_ab.sh 4 10000 create_plain.json)
View __usage.adoc

Usage

Use latest Neo4j for best results, e.g. 2.2.2 or 2.3.0-M02 (http://neo4j.com/download) On a machine with 12 cores use concurrency 24

Create 1 node, 1 rel, 1 property per request, 1M requests

Total: 1M nodes, rels, props


View dothis.java
private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int i = 0;
Transaction tx = db.beginTx();
try {
for ( Node node : GlobalGraphOperations.at(db).getAllNodes()) {
Date theDate = DATE_FORMAT.parse((String)node.getProperty("my_date_as_string_property", "2099-12-31 12:00:00"));
node.setProperty("new_date_as_millis", theDate.getTime());
i++;
// Commit every x transactions
if (i % 10000 == 0) {
View gist:bf4547ef108914cd82f6
int i = 0;
Transaction tx = db.beginTx();
try {
for ( Relationship relationship : GlobalGraphOperations.at(db).getAllRelationships()) {
// Do some work on relationship property
i++;
// Commit every x transactions
if (i % 10000 == 0) {
tx.success();
tx.close();
@maxdemarzi
maxdemarzi / CreateNode.scala
Created Mar 9, 2015
Peak Transactions is 64 on my MBP
View CreateNode.scala
import io.gatling.core.Predef._
import io.gatling.core.scenario.Simulation
import io.gatling.http.Predef._
import scala.concurrent.duration._
class CreateNode extends Simulation {
val httpConf = http
.baseURL("http://localhost:7474")
@maxdemarzi
maxdemarzi / Rakefile
Last active Aug 29, 2015
Neo4j In Production Rake script
View Rakefile
require 'net/http'
require 'uri'
# Set Java Home
unless ENV["JAVA_HOME"]
puts "You need to set your JAVA_HOME environment variable by running:"
javahome = `/usr/libexec/java_home`
command = "export JAVA_HOME=\"" + javahome.strip + "\""
puts command
end
@maxdemarzi
maxdemarzi / LockDownSecurityRule.java
Created Sep 3, 2014
Example Neo4j Security Rule
View LockDownSecurityRule.java
package org.neo4j.server.rest.security;
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.DatatypeConverter;
import java.util.StringTokenizer;
import java.io.UnsupportedEncodingException;
public class LockDownSecurityRule implements SecurityRule {
public static final String REALM = "WallyWorld"; // as per RFC2617 :-);
You can’t perform that action at this time.