Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Max De Marzi maxdemarzi

🏠
Working from home
View GitHub Profile
View config.json
{
"options": {
"generate_report": true,
"verbose": true,
"report_file_location": "purged_css_report_data.json"
}
}
@maxdemarzi
maxdemarzi / queries.cypher
Last active Mar 20, 2020
Cypher Queries for Finding Fraud Part 2 Revisited
View queries.cypher
WITH ["Jennifer","Michelle","Tanya","Julie","Christie",
"Sophie","Amanda","Khloe","Sarah","Kaylee"] AS names
FOREACH (r IN range(1,1000000) |
CREATE (:User {username:names[r % size(names)] + "-" + r}) );
FOREACH (r IN range(1,1000000) | CREATE (:Account {number: r, balance: round(rand() * 1000000) / 100.0, type:"Savings"}))
UNWIND range(1,1000000) AS number
MATCH (user), (account)
@maxdemarzi
maxdemarzi / cypher.txt
Created Sep 11, 2019
Real Property Graph
View cypher.txt
Schema
------
CREATE CONSTRAINT ON (n:Location) ASSERT n.id IS UNIQUE;
CREATE CONSTRAINT ON (n:Owner) ASSERT n.name IS UNIQUE;
CREATE INDEX ON :Address(addr, zip);
Data Exploration
@maxdemarzi
maxdemarzi / collect.cypher
Created Aug 19, 2019
Fighting Fraud with Neo4j part 2
View collect.cypher
MATCH (n:User)
RETURN n.partition, COUNT(*) AS members, COLLECT(n.name) AS names
ORDER BY members DESC
LIMIT 10
@maxdemarzi
maxdemarzi / data.cypher
Created Aug 17, 2019
Cypher Scripts for Neo4j Fraud Blog Post
View data.cypher
CREATE (john:User {name:"John"})
CREATE (sheila:User {name:"Sheila"})
CREATE (robert:User {name:"Robert"})
CREATE (karen:User {name:"Karen"})
CREATE (m1:Merchant {name:"Computer Store"})
CREATE (m2:Merchant {name:"Gas Station"})
CREATE (m3:Merchant {name:"Jewelry Store"})
CREATE (m4:Merchant {name:"Furniture Store"})
CREATE (m5:Merchant {name:"Optometrist"})
CREATE (m6:Merchant {name:"Coffee Shop"})
@maxdemarzi
maxdemarzi / exercise-1.query.cypher
Last active May 30, 2019
Modeling Cypher Exercise 1 and 2
View exercise-1.query.cypher
MATCH (company)<-[:WORKS_FOR]-(me:Person{username:'ian'})-[:HAS_SKILL]->(skill),
(company)<-[:WORKS_FOR]-(colleague)-[r:HAS_SKILL]->(skill)
WHERE r.level > 1
RETURN colleague.username AS username,
count(skill) AS score,
collect(skill.name) AS skills
ORDER BY score DESC
View Post.java
package com.maxdemarzi.models;
import humanize.Humanize;
import lombok.Data;
import org.jooby.Upload;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@maxdemarzi
maxdemarzi / data.cypher
Created Mar 22, 2018
Find meeting times
View data.cypher
CREATE (person1:Person {name: "Max"})
CREATE (person2:Person {name: "Alex"})
CREATE (person3:Person {name: "Andrew"})
CREATE (floor1:Floor {name: "Floor 1"})
CREATE (floor2:Floor {name: "Floor 2"})
CREATE (person1)-[:SITS_IN]->(floor1)
CREATE (person2)-[:SITS_IN]->(floor1)
CREATE (person3)-[:SITS_IN]->(floor2)
CREATE (room1:Room {name:"Room 1"})
CREATE (room2:Room {name:"Room 2"})
@maxdemarzi
maxdemarzi / bom.cypher
Last active Mar 11, 2020
Bill of Materials sample data
View bom.cypher
CREATE (f1:Family {id:'f1'})
CREATE (f2:Family {id:'f2'})
CREATE (f3:Family {id:'f3'})
CREATE (a1:Asset {id:'a1'})
CREATE (a2:Asset {id:'a2'})
CREATE (a3:Asset {id:'a3'})
CREATE (a4:Asset {id:'a4'})
CREATE (a5:Asset {id:'a5'})
CREATE (a6:Asset {id:'a6'})
CREATE (a7:Asset {id:'a7'})
View ImportSwapnilRunnable.java
package com.maxdemarzi.imports;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.maxdemarzi.schema.Labels;
import com.maxdemarzi.schema.RelationshipTypes;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.neo4j.graphdb.*;
You can’t perform that action at this time.