Skip to content

Instantly share code, notes, and snippets.

@davidfauth
davidfauth / neo4j_fabric_aura.conf
Last active June 22, 2021 15:16
Neo4j 4.3.0 Fabric with Aura
#*****************************************************************
# Neo4j configuration
#
# For more details and a complete list of settings, please see
# https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/
#*****************************************************************
# The name of the default database.
#dbms.default_database=neo4j
@davidfauth
davidfauth / neo4j-wcc-example.cyp
Created December 1, 2020 14:02
Neo4j WCC Example
// Data was randomly generated data
// Create the Graph
CALL gds.graph.create(
'wcc-graph', {
Customer: { label: 'Customer' },
Email: { label: 'Email' },
Phone: { label: 'Phone' }
},
{
@davidfauth
davidfauth / neo4j_rbac_example.cql
Created October 12, 2020 15:58
neo4j_4.0_rbac_example
// RBAC Example
// Nodes -> Person / Phone / Email / Account
// Relationships -> :HAS_PHONE / :HAS_EMAIL / :HAS_ACCOUNT
// Roles -> Manager / ServiceRep / NoAccount
// Users -> John / Sally / George
// Code
:USE system
@davidfauth
davidfauth / neo4j_4_docker_ssl
Created June 3, 2020 12:54
Neo4j 4.0.4_DockerCompose_SSL
version: '3'
networks:
lan:
services:
core1:
image: neo4j:4.0.4-enterprise
networks:
dbms.default_listen_address=0.0.0.0
dbms.default_advertised_address=xxx.xxx.xxx.xxx
# Bolt connector
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=REQUIRED
dbms.connector.bolt.listen_address=:17687
dbms.connector.bolt.advertised_address=:17687
# HTTP Connector. There can be zero or one HTTP connectors.
import json
from py2neo import authenticate, Graph, NodeSelector, Node, Relationship
import sys
import time
from neo4j import GraphDatabase
def run_cypher_query(tx, query):
return tx.run(query)
### neo4jfourloadexample.py
### 22 April 2020
### David Fauth
### @davefauth
import os
import sys
import csv
from io import StringIO
@davidfauth
davidfauth / kafka_neo4j_ssl.adoc
Created October 14, 2019 12:58
Kafa Neo4j SSL Configuration

Overview:

This document, Neo4j Security with Kafka Streams, provides guidance to configure SSL security between Kafka and Neo4j. This will provide data encryption between Kafka and Neo4j.

This does not address ACL confguration inside of KAFKA.

Self Signed Certificates

This section came from https://medium.com/talking-tech-all-around/how-to-enable-and-verify-client-authentication-in-kafka-21e936e670e8
Make sure that you have truststore and keystore JKSs for each server.+ In case you want a self signed certificate, you can use the following commands:+

@davidfauth
davidfauth / SparkToNeo4j.html
Created October 8, 2019 12:46
Neo4j Spark Notebook
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta name="databricks-html-version" content="1">
<title>Neo4j Chicago Crime Notebook - Databricks</title>
<meta charset="utf-8">
<meta name="google" content="notranslate">
<meta name="robots" content="nofollow">
@davidfauth
davidfauth / Neo4j-Databricks-Example.txt
Last active September 25, 2019 15:36
Spark to Neo4j example
#Step 1
%python
#write a file to DBFS using Python I/O APIs
with open("/dbfs/tmp/neo4_test.csv", 'w') as f:
f.write("id,name,emp_id,employer\n")
for x in range(500):
f.write(str(x) + ",name_" + str(x) + "," + str(x) + ",emp_name_" + str(x) + "\n")
f.close()
#Step 2 Load to Dataframe