Skip to content

Instantly share code, notes, and snippets.

@davidfauth
davidfauth / Neo4j_4_0_DriverWriteTest
Created Aug 26, 2019
Neo4jDriverWrite_40Cluster
View Neo4j_4_0_DriverWriteTest
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.time.Duration;
import java.time.Instant;
View Neo4jDriverWriteTest.java
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.time.Duration;
import java.time.Instant;
View rbac.cql
CREATE DATABASE library;
CREATE DATABASE c360;
CREATE DATABASE iam;
SHOW DATABASES;
:use system;
START DATABASE library;
START DATABASE c360;
View docker-compose-bloom.yml
version: '3'
services:
accenture:
image: neo4j:3.5.8-enterprise
ports:
- 7474:7474
- 7473:7473
View kafkaNeo4j_Cluster
### Neo4j.conf
kafka.zookeeper.connect=172.xx.xx.xx:2181
kafka.bootstrap.servers=172.xx.xx.xx:9092
streams.sink.enabled=true
streams.sink.polling.interval=1000
streams.sink.topic.cypher.Neo4jPersonTest=MERGE (p:Person{name: event.name, surname: event.surname}) MERGE (f:Family{name: event.surname}) MERGE (p)-[:BELONGS_TO]->(f)
streams.sink.topic.cypher.blogpost_maxmind_albums=FOREACH(ignoreMe IN CASE WHEN event.type='insert' THEN [1] ELSE [] END | MERGE (c:Album{id:event.data.id}) on match set c.name = event.data.name on create set c.name = event.data.name) FOREACH(ignoreMe IN CASE WHEN event.type='delete' THEN [1] ELSE [] END | MERGE (c:Album{id:event.data.id}) detach delete c) FOREACH(ignoreMe IN CASE WHEN event.type='update' THEN [1] ELSE [] END | MERGE (c:Album{id:event.data.id}) set c.name=event.data.name, c.genre=event.data.genre)
streams.sink.topic.cypher.blogpost_maxmind_users=FOREACH(ignoreMe IN CASE WHEN event.type='insert' THEN [1] ELSE [] END | MERGE (u:User{id:event.data.id}) on match set u.nam
View pythonNeo4jUberH3
import simplejson
from urllib.request import urlopen
import urllib.request
import urllib.parse
from neo4j.v1 import GraphDatabase
import time
uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "changeYourPassword"))
View Neo4jHive.java
package com.neo4j.hadoop.example;
import org.codehaus.jackson.map.ObjectMapper;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.schema.Schema;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.tooling.GlobalGraphOperations;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@davidfauth
davidfauth / bitcoinAddressDetails
Created Feb 2, 2015
Bitcoin Transactions for an address
View bitcoinAddressDetails
{
"hash160":"a54e0ee6071328dc58c8c37a4e974c4816364f24",
"address":"1G541ENwQBqG3WZgvYtVCojVgdHFpJ8RXs",
"n_tx":25,
"total_received":3393980000,
"total_sent":3393980000,
"final_balance":0,
"txs":[{
"ver":1,
"inputs":[
@davidfauth
davidfauth / sampleBitcoinTransaction.json
Created Feb 2, 2015
Bitcoin Transactions for 1G541ENwQBqG3WZgvYtVCojVgdHFpJ8RXs
View sampleBitcoinTransaction.json
{
"hash160":"a54e0ee6071328dc58c8c37a4e974c4816364f24",
"address":"1G541ENwQBqG3WZgvYtVCojVgdHFpJ8RXs",
"n_tx":25,
"total_received":3393980000,
"total_sent":3393980000,
"final_balance":0,
"txs":[{
"ver":1,
"inputs":[
@davidfauth
davidfauth / imageIntoNeo4J.java
Created Sep 16, 2014
Convert image to base64 and drop into Neo4J
View imageIntoNeo4J.java
package pe.archty;
/**
* Created by davidfauth on 9/16/14.
*/
import java.io.IOException;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
import java.io.ByteArrayInputStream;