Skip to content

Instantly share code, notes, and snippets.

Watching the chamaeleon.

Michael Hunger jexp

Watching the chamaeleon.
View GitHub Profile
jexp / 01-load.cypher
Last active Jul 6, 2021
Wahlomat Daten Sachsen Anhalt 2021
View 01-load.cypher
create index on :Partei(name);
create index on :These(name);
create constraint if not exists on (p:Partei) assert is unique;
create constraint if not exists on (t:These) assert is unique;
load csv with headers from
as row
merge (p:Partei {id:toInteger(row.`Partei: Nr.`)}) on create set p.text = row.`Partei: Name`, = row.`Partei: Kurzbezeichnung`
View movies.cypher
//Movies based on similar users and favorite genres
MATCH (u:Users)-[:WATCHED]->(m:Movies)
WHERE u.userId ='1'
WITH collect(m) as watchedMovies
MATCH (u:Users)-[:WATCHED]->(m1:Movies)-[s:SIMILAR]->(m2:Movies),
(m2)-[:GENRES]->(g:Genres), (u)-[:FAVORITE]->(g)
WHERE u.userId ='10' and m2 IN watchedMovies
RETURN distinct u.userId as userId, g.genres as genres, m2.title as title, m2.rating_mean as rating
jexp /
Created Jun 8, 2021
Random Giphy images in Jupyter notebook to keep your audience entertained while they wait for data processing
!pip install giphy_client
import giphy_client
import random
from IPython.core.display import display, HTML
api_instance = giphy_client.DefaultApi()
api_key = '***' # from
search = 'science'
api_response = api_instance.gifs_search_get( api_key, search, limit=25)
images = [img.images.fixed_height.url for img in]
jexp / dependencies.cypher
Last active Jun 4, 2021
Google to #Neo4j graph on
View dependencies.cypher
// load initial package, adjust your name and version
with "org.neo4j:neo4j-kernel" as name, '4.2.6' as version
call apoc.load.json(""+name+"/v/"+version+"/dependencies") yield value
where value.package.system = 'MAVEN'
merge (p:Package:Maven {, version:value.version})
with *
unwind value.dependencies as dep
with p, dep where dep.package.system = 'MAVEN'
merge (d:Package:Maven {, version:dep.version})
View lombardi.cypher
call apoc.load.json("") yield value
unwind value.nodes as n
call apoc.create.node([split(n.type,'#')[1]], n {.id, .name}) yield node
with value,,"id") as nodes
unwind value.links as r
call apoc.create.relationship(nodes[r.source],split(r.type,'#')[1], {amount:toFloat(r.amount)},nodes[]) yield rel
return count(*);
jexp / transcript.txt
Created Apr 2, 2021
Devrel twitter space hoste by Colby with Angie, Sarah, Kelsey, Emily, James
View transcript.txt
Dev Rel
Don’t sound smart
Help others feels smart
Break thinks down to simple bits
Developer empathy
Not just for senior audiences
Netlify - docs, dx-eng, eng-integrations
Employee of community. Company is a sponsor
Ambassador progr.
jexp /
Last active Mar 16, 2021
Read correct YouTube Playlist views from the YT data API with Python (here Neo4j Twitch Stream videos)
# -*- coding: utf-8 -*-
# pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
# python
import os
import sys
import json
jexp / load_nature_papers.cypher
Created Mar 10, 2021
Loading the cocited papers from the Nature visualisation into Neo4j
View load_nature_papers.cypher
call apoc.load.csv('!cociteNodes.csv',{})
yield map
create (p:Paper) set p =map {.NatureID, .PubYear, .Title, .HierCat, .size}
return count(*) as papers;
create index on :Paper(NatureID);
call db.awaitIndexes();
call apoc.load.csv('!cociteEdges.csv',{ignore:['path']})
yield map
jexp / categories.csv
Created Jan 27, 2021
Northwind CSV Files Neo4j Import
View categories.csv
CategoryID CategoryName Description Picture
1 Beverages Soft drinks, coffees, teas, beers, and ales \x
2 Condiments Sweet and savory sauces, relishes, spreads, and seasonings \x
3 Confections Desserts, candies, and sweet breads \x
4 Dairy Products Cheeses \x
5 Grains/Cereals Breads, crackers, pasta, and cereal \x
6 Meat/Poultry Prepared meats \x
7 Produce Dried fruit and bean curd \x
8 Seafood Seaweed and fish \x
View create-job-data.cypher
create constraint on (j:Job) assert is unique;
// rows = [{id:1, name:"ddd"},{id:2,,}]
session.write_transaction(lambda tx:"""
unwind $rows as row
merge (j:Job {}) on create set =
""", rows=rows)
call apoc.periodic.iterate(
"call apoc.load.json(url) yield value return value",