Skip to content

Instantly share code, notes, and snippets.

Paul O'Neill Pablissimo

Block or report user

Report or block Pablissimo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Pablissimo
Pablissimo / out.txt
Created Aug 8, 2019
Example output of a cypher-shell call with --format verbose for SO question https://stackoverflow.com/questions/56899593/redirect-neo4j-profiling-output-to-file
View out.txt
+---+
| n |
+---+
+---+
+----------------------------------------------------------------------+| Plan | Statement | Version | Planner | Runtime | Time |+----------------------------------------------------------------------+| "EXPLAIN" | "READ_ONLY" | "CYPHER 3.5" | "COST" | "COMPILED" | 1 |+----------------------------------------------------------------------+
+------------------+----------------+-------------+-------+
| Operator | Estimated Rows | Identifiers | Other |
+------------------+----------------+-------------+-------+
@Pablissimo
Pablissimo / craft.js
Created Aug 5, 2019
A quick command-line Node app to look at the Neo4j Minecraft database and figure out how to make any item in it
View craft.js
// We take a dependency on the neo4j-driver module for the connection to the database
const neo4j = require('neo4j-driver').v1;
// And we'll need a driver to connect to the database. We'll disable 'lossless integers'
// because sodding about with the Neo4j integer type to do node lookups is a pain, and
// our graph doesn't have anywhere near enough nodes to worry about blowing through 53
// bits of integer precision
const driver = neo4j.driver
(
'bolt://localhost:7687', // Default setup for Neo4j Desktop
View Blowing up APOC.cypher
MATCH (movie: Movie { title: 'Top Gun' })<-[acted_in: ACTED_IN]-(actor: Person)
WITH collect(distinct actor) + movie as nodes, collect(distinct acted_in) as relationships
CALL apoc.export.csv.data(nodes, [], 'nodes.csv', {}) YIELD file as nodefile
UNWIND relationships as relationship
CALL apoc.create.vRelationship(startNode(relationship), type(relationship), { title: relationship.title }, endNode(relationship)) YIELD rel
WITH collect(rel) as relationshipsAmended, nodefile
CALL apoc.export.csv.data([], relationshipsAmended, 'edges.csv', {}) YIELD file as edgefile
RETURN edgefile, nodefile
@Pablissimo
Pablissimo / minecraft-with-recipes.cypher
Last active Jul 29, 2019
Cypher script for creating an initial Neo4j graph database representing the Minecraft crafting and forging recipe book where Recipes are their own nodes with relevant output quantities
View minecraft-with-recipes.cypher
MERGE (n:Resource{name:"Wooden Plank"});
MERGE (n:Resource{name:"Stick"});
MERGE (n:Resource{name:"Torch"});
MERGE (n:Resource{name:"Crafting Table"});
MERGE (n:Resource{name:"Furnace"});
MERGE (n:Resource{name:"Chest"});
MERGE (n:Resource{name:"Wood Pickaxe"});
MERGE (n:Resource{name:"Stone Pickaxe"});
MERGE (n:Resource{name:"Iron Pickaxe"});
MERGE (n:Resource{name:"Gold Pickaxe"});
@Pablissimo
Pablissimo / minecraft.cypher
Created Jul 29, 2019
Cypher script for creating an initial Neo4j graph database representing the Minecraft crafting and forging recipe book
View minecraft.cypher
MERGE (n:Resource{name:"Wooden Plank"});
MERGE (n:Resource{name:"Stick"});
MERGE (n:Resource{name:"Torch"});
MERGE (n:Resource{name:"Crafting Table"});
MERGE (n:Resource{name:"Furnace"});
MERGE (n:Resource{name:"Chest"});
MERGE (n:Resource{name:"Wood Pickaxe"});
MERGE (n:Resource{name:"Stone Pickaxe"});
MERGE (n:Resource{name:"Iron Pickaxe"});
MERGE (n:Resource{name:"Gold Pickaxe"});
@Pablissimo
Pablissimo / Items.csv
Created Jul 29, 2019
An extract of the items in Minecraft and recipes to craft them, and the script to do the extract (to be run in Chrome Developer Tools) from http://minecraftsavant.weebly.com
View Items.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Item
Wooden Plank
Stick
Torch
Crafting Table
Furnace
Chest
Wood Pickaxe
Stone Pickaxe
Iron Pickaxe
@Pablissimo
Pablissimo / build.log
Created Aug 14, 2016
Chutzpah build failure
View build.log
psake version 4.2.0
Copyright (c) 2010 James Kovacs
Executing Clean-Solution-NoVS
Microsoft (R) Build Engine version 4.6.1586.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Executing Build-Solution-NoVS
Microsoft (R) Build Engine version 4.6.1586.0
View confirm_model.php
require_once('/var/www/resources/MiiCard/miiCard.Consumers/miiCard.Consumers.php');
if (session_id() == "")
{
session_start();
}
$miiCardObj = new Consumers\MiiCard(MIICARD_CONSUMER_KEY, MIICARD_CONSUMER_SECRET, null, null, null, MIICARD_FORCE_CLAIMS, MIICARD_SIGNUP_MODE);
if ($miiCardObj->isAuthorisationCallback())
{
@Pablissimo
Pablissimo / DataMemberAwareEnumJsonConverter
Created Jul 31, 2013
A JsonConverter (for Newtonsoft's JSON.NET) that respects the Name property of DataMember attributes applied to enumeration members, falling back to the enumeration member name where no DataMember attribute exists (or where a name has not been supplied)
View DataMemberAwareEnumJsonConverter
/// <summary>
/// A JsonConverter that respects the Name property of DataMember attributes
/// applied to enumeration members, falling back to the enumeration member
/// name where no DataMember attribute exists (or where a name has not
/// been supplied). Entirely experimental, use at your own risk.
///
/// Paul O'Neill, paul@pablissimo.com, 31/07/13
/// </summary>
public class DataMemberAwareEnumJsonConverter : JsonConverter
{
@Pablissimo
Pablissimo / DataMemberAwareEnumJsonConverter
Created Jul 31, 2013
A JsonConverter (for Newtonsoft's JSON.NET) that respects the Name property of DataMember attributes applied to enumeration members, falling back to the enumeration member name where no DataMember attribute exists (or where a name has not been supplied)
View DataMemberAwareEnumJsonConverter
/// <summary>
/// A JsonConverter that respects the Name property of DataMember attributes
/// applied to enumeration members, falling back to the enumeration member
/// name where no DataMember attribute exists (or where a name has not
/// been supplied). Entirely experimental, use at your own risk.
///
/// Paul O'Neill, paul@pablissimo.com, 31/07/13
/// </summary>
public class DataMemberAwareEnumJsonConverter : JsonConverter
{
You can’t perform that action at this time.