Skip to content

Instantly share code, notes, and snippets.

View ernestoe's full-sized avatar

Ernesto Echeverria ernestoe

  • San Salvador, El Salvador
View GitHub Profile
@ernestoe
ernestoe / command.sh
Last active May 1, 2018 14:19 — forked from metaskills/command.sh
Ubuntu 16.04 Install Latest FreeTDS
$ sudo apt-get install wget
$ sudo apt-get install build-essential
$ sudo apt-get install libc6-dev
$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.91.tar.gz
$ tar -xzf freetds-1.00.91.tar.gz
$ cd freetds-1.00.91
$ ./configure --prefix=/usr/local --with-tdsver=7.3
$ make
$ make install
@ernestoe
ernestoe / rspec_model_testing_template.rb
Last active September 4, 2015 12:04 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:

Is this a binding bug?

Start with an empty database and load sample data

Launch your favorite neo4j browser and run the following, in a clean database. If you have existing data, the queries are slow as they will match all existing nodes.

@ernestoe
ernestoe / duplicate_relationships.adoc
Last active April 20, 2023 02:28
Finding Duplicate Relationships

Finding Duplicate Relationships

Introduction to Problem

Graph databases and Neo4j particularly, are excellent for a different set of purposes, such as storing, traversing and presenting graphy data (Graphs are Everywhere!), but let’s face it: too much freedom and not enough discipline might bring bad data quality into the formula. A common problem results when creating nodes and properties without indexes or when improperly using MERGE instead of CREATE.

@ernestoe
ernestoe / label_analysis
Created April 17, 2015 16:30
Generic introspection script for obtaining information about labels, keys and frequencies
// Generic introspection script for obtaining information about labels, keys and frequencies
// first let's extract all distinct labels and their frequencies
MATCH
(node)
WITH
labels(node) AS labels
UNWIND
labels AS label
WITH
label, count(*) as label_count
@ernestoe
ernestoe / GreenMan
Last active August 29, 2015 14:06 — forked from swainjo/GreenMan
== Green Man POC
:neo4j-version: neo4j-2.1
:author: John Swain
:twitter: @swainjo
:tags: domain:POC
=== Load Sample Data
//setup
//hide
== Chess Games and Positions in Neo4j
:neo4j-version: 2.0.0
:author: Wes Freeman
:twitter: @wefreema
:tags: chess
The goal is to load a bunch of chess games into Neo4j for further analysis. Scores listed are Stockfish's take on a position after a 25 move horizon (but this number can be deepened as the graph is filled out or as more processing is done). Positions can also be loaded as alternative moves (not connected to a game) based on suggestions from Stockfish. The positions are recorded as link:http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation[FEN], a human-readable/compressed chess board state notation.
=== Schema diagram