Skip to content

Instantly share code, notes, and snippets.

@jalakoo
jalakoo / star_wars_characters_filtered.csv
Created April 6, 2023 22:49
Star Wars Characters + homeworlds + species
We can't make this file beautiful and searchable because it's too large.
ID,name,description,home_world,species
1,1151,1151 was a clone cadet who was a part of the Clone Youth Brigade during the Clone Wars.,Kamino,Human
2,1174,"1174, nicknamed ""Whiplash,"" was a clone trooper cadet who served in the Clone Youth Brigade during the Clone Wars.",Kamino,Human
9,99,"99 was a human male clone of Jango Fett bred to be a clone trooper for the Grand Army of the Republic. He was malformed in the cloning process, however, and suffered numerous genetic and physical defects. As a result, he was deemed unfit for service in the army and assigned to be a maintenance duty clone, providing janitorial and maintenance work on his home planet of Kamino. During his time on Kamino, he grew attached to clone cadets as they trained to become troopers, viewing them all as brothers and individuals, rather than clone numbers. He befriended Domino Squad during their time training, and stopped Hevy, a member of Domino Squad, from abandoning them. He inspired Hevy and urged him to see himself as a team with hi
@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 / 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 / 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 / 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 / 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)