Skip to content

Instantly share code, notes, and snippets.

View kbastani's full-sized avatar
💭
Coding

Kenny Bastani kbastani

💭
Coding
View GitHub Profile
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@kbastani
kbastani / neo4j-cypher-delete-id-list.txt
Created August 14, 2013 19:06
Follow the steps in this gist to find and delete duplicate nodes on property and index in Neo4j graph database web admin console.
// Delete duplicate nodes as a list collected from the output of neo4j-cypher-duplicate-get-node.txt
START n=node(1120038,1120039,1120040,1120042,1120044,1120048,1120049,1120050,1120053,1120067,1120068)
// Replace IDs above with the IDs from CommaSeparatedListOfIds in neo4j-duplicate-get-node.txt
MATCH n-[r]-()
DELETE r, n
@tekiegirl
tekiegirl / ContributorCommunity.adoc
Last active December 24, 2021 13:57
Initial tests for the Contributor Community graph

Contributor Community Graph

Developers using Neo4j are currently working alone when they should be working together, but they don’t know who is working on the same technologies. This graph aims to solve this by linking developers with similar interests, projects and events.

Setup of known data

@jexp
jexp / cypher.js
Created January 19, 2014 15:44
Javascript Snippet to simply access transactional Cypher Http endpoint of the Neo4j Server (see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html)
var r=require("request")
function cypher(query,params,cb) {
r.post({uri:"http://localhost:7474/db/data/transaction/commit",
json:{statements:[{statement:query,parameters:params}]}},
function(err,res) { cb(err,res.body)})
}
var query="MATCH (n:User) RETURN n, labels(n) as l LIMIT {limit}"
var params={limit: 10}
var cb=function(err,data) { console.log(JSON.stringify(data)) }
@prb
prb / maven_spark_magic.xml
Created May 12, 2014 16:47
Fragment of a pom.xml file for packaging separate worker and driver JARs for Spark.
<!-- Fragment of pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
@jexp
jexp / install-graphgist.sh
Last active October 22, 2021 01:08
How to deploy a Neo4j Graph-Gist locally to not expose any data
# How to run Neo4j GraphGists locally?
git clone https://github.com/neo4j-contrib/rabbithole
cd rabbithole
mvn clean test-compile
mvn exec:java&
sleep 20
# GraphGists only run in your browser, so in your asciidoc-file use the attribute at the top :neo4j-version: local
@jexp
jexp / twitter_to_neo.rb
Last active August 29, 2015 14:04
Simple Ruby script to pull tweets from Twitter into Neo4j using Cypher
BEARER='...'
def load_tweets(query,since_id=nil,lang="en",page=1,rpp=100)
res=RestClient.get('https://api.twitter.com/1.1/search/tweets.json',
{:params=> {:q=>query, :lang=>lang,:count=>rpp,:result_type=>:recent,:since_id=>since_id},
:accept=>:json,
:Authorization => "Bearer #{BEARER}"})
puts "query '#{query}'\n since id #{since_id} result #{res.code}"
return [] unless res.code==200
data=JSON.parse(res.to_str)
@ikwattro
ikwattro / GithubEventAnalysisWithNeo4j.markdown
Last active December 2, 2022 17:49
Github Events Analysis with Neo4j

Github Events Analysis with Neo4j

Imgur

On July 22, Github announced the 3rd Annual Github Data Challenge presenting multiple sources of data available.

This sounded to me a good opportunity to use their available data and import it in Neo4j in order to have a lot of fun at analyzing the data that fits naturally in a graph.

As I work mainly offline or behind military proxies that do not permit me to use the ReST API, I decided to go for the Github Archive available here, you can then download json files representing Github Events on a daily/hour basis.

name := "playground"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.1.0"
libraryDependencies += "net.sf.opencsv" % "opencsv" % "2.3"