Skip to content

Instantly share code, notes, and snippets.

@Pablissimo
Pablissimo / Items.csv
Created July 29, 2019 09:40
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
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 / craft.js
Created August 5, 2019 09:03
A quick command-line Node app to look at the Neo4j Minecraft database and figure out how to make any item in it
// 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
@Pablissimo
Pablissimo / minecraft-with-recipes.cypher
Last active November 13, 2022 06:20
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
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 / out.txt
Created August 8, 2019 11:20
Example output of a cypher-shell call with --format verbose for SO question https://stackoverflow.com/questions/56899593/redirect-neo4j-profiling-output-to-file
+---+
| n |
+---+
+---+
+----------------------------------------------------------------------+| Plan | Statement | Version | Planner | Runtime | Time |+----------------------------------------------------------------------+| "EXPLAIN" | "READ_ONLY" | "CYPHER 3.5" | "COST" | "COMPILED" | 1 |+----------------------------------------------------------------------+
+------------------+----------------+-------------+-------+
| Operator | Estimated Rows | Identifiers | Other |
+------------------+----------------+-------------+-------+
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.cypher
Created July 29, 2019 12:10
Cypher script for creating an initial Neo4j graph database representing the Minecraft crafting and forging recipe book
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 / build.log
Created August 14, 2016 13:54
Chutzpah build failure
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
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 July 31, 2013 15:51
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)
/// <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 July 31, 2013 15:51
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)
/// <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
{