Skip to content

Instantly share code, notes, and snippets.

@jalakoo
jalakoo / neo4j-5-install.md
Last active September 2, 2023 07:20
neo4j-5-install.md

Neo4j + Raspberry Pi Install Instructions

These steps tested using Raspberry Pi Imager 1.7.4 loading Debian Bullseye with Raspberry Pi Desktop (2023-02-21) onto a 2019 Rasbperry Pi 4 model B. All command examples are for running from a CLI/terminal.

Java

Java is required to run a Neo4j instance on a pi. JDK version 17+ is recommended when using Neo4j v5.5.0+

To check your current version (if any):

java -version
@jalakoo
jalakoo / neo4j_conn.py
Created June 4, 2022 16:35
neo4j python utility class
from neo4j import GraphDatabase, unit_of_work, Transaction
class Neo4jConnection:
def __init__(self, uri, user, pwd):
"""
Initialize a driver and test for connectivity.
Args:
uri (str): URI for the Neo4j instance to access
@jalakoo
jalakoo / neo4j_example.py
Last active June 7, 2022 16:03
Neo4j Simple Example
from neo4j import GraphDatabase, unit_of_work
uri = ""
username = ""
password = ""
driver = GraphDatabase.driver(uri, auth=(username, password))
@unit_of_work(timeout=30)
def generic_function(tx, **kwargs):
result = tx.run("MATCH (n) RETURN n", **kwargs)
@jalakoo
jalakoo / keywords.csv
Last active January 20, 2022 20:37
PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw_keywords
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"word"
"ability"
"absolute"
"absolutely"
"abundantly"
"academy"
"accelerate"
"accept"
"accepted"
"access"
@jalakoo
jalakoo / stop_words.txt
Created January 19, 2022 16:55
General English Stop Words
0o
0s
3a
3b
3d
6b
6o
a
a1
a2
@jalakoo
jalakoo / videos.csv
Created January 19, 2022 02:33
PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw_videos
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 7.
video,title,url
video01,"Hamilton - Discover Neo4j AuraDB Free with Michael and Alexander","https://www.youtube.com/watch?v=rPlYduWayMo&list=PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw&index=2"
video02,"Advent of Code with Cypher with Pierre Halftermeyer", "https://www.youtube.com/watch?v=Rp26amGwgBI&list=PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw&index=4"
video03,"Pandora Papers - Discover Neo4j AuraDB Free with Michael and Alexander", "https://www.youtube.com/watch?v=IHfAj8DX8DQ&list=PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw&index=4"
video04,"Pokemon - Discover Neo4j AuraDB Free with Joe and Alexander","https://www.youtube.com/watch?v=B5tn1GPEQC8&list=PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw&index=5"
video05,"DIscover Neo4j Aura Free with Michael and Alex - Consumer Complaints database","https://www.youtube.com/watch?v=dTp6iCMEcng&list=PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw&index=6"
video06,"Discover Neo4j Aura Fre with Michael and Alex - Importing a Kaggle Employee Attrition Dataset","https://www.youtube.com/watch?v=U6avi4IF_CU&list=PL9Hl4
@jalakoo
jalakoo / transcript_word_counts.csv
Last active January 26, 2022 02:22
PL9Hl4pk2FsvVZaoIpfsfpdzEXxyUJlAYw_transcripts
video word count
video09 launcher 1
video09 knew 1
video09 large 1
video09 exhibition 1
video09 based 1
video09 opening 1
video09 laughing 1
video09 influence 1
video09 theme 1
@jalakoo
jalakoo / chessdataset.cypher
Created January 11, 2022 23:57
discoveraurafree - week 3 - load data
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/zq99/pgn2data/master/samples/caruana_carlsen_2018_moves.csv" AS row
MERGE (p:Position {fen:row.fen})
CREATE (m:Move {move:row.move, colour:row.color, no:tointeger(row.move_no_pair), piece:row.piece})
CREATE (m)-[:RESULTS_IN]->(p);
@jalakoo
jalakoo / nbadataset.cypher
Last active January 11, 2022 23:49
discoveraurafree - week 1 - load data
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/fivethirtyeight/data/master/nba-elo/nbaallelo.csv" AS row
//skipping doubles, also Aura Free limit of 50k nodes, ~ 100 teams
WITH row LIMIT 99900 WHERE row._iscopy="0"
MERGE (ht:Team {code:row.team_id})
ON CREATE SET ht.name = row.fran_id
MERGE (at:Team {code:row.opp_id})
ON CREATE SET at.name = row.opp_fran
CREATE (m:Match {id:row.game_id, venue:right(row.game_id, 3), date:row.date_game})
WITH ht, at, m, row.pts AS hpoints, row.opp_pts AS apoints,
row.elo_i AS hse, row.elo_n AS hee, row.opp_elo_i AS ase,
@jalakoo
jalakoo / boardgamegeek.cypher
Created January 11, 2022 23:47
discoveraurafree - week 2 - load data
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/ThaWeatherman/scrapers/b8757711296703356891f8f4e7757de6698a6b5b/boardgamegeek/games.csv" AS ROW
WITH ROW WHERE tointeger(row.playingtime) > 9
AND tointeger(row.playingtime) <61
CREATE (g:Game {name:row.name, weight:tofloat(row.average_weight),
rating:tofloat(row.average_rating),
playingTime:tointeger(row.playingtime), id:row.id})
MERGE (pmin:PlayerCount {value:tointeger(row.minplayers)})
MERGE (pmax:PlayerCount {value:tointeger(row.maxplayers)})
WITH g, pmin, pmax
CREATE (g)-[:HAS_MIN_PLAYERS]->(pmin)