Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Coding

Kenny Bastani kbastani

💭
Coding
View GitHub Profile
View build.sbt
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"
@ikwattro
ikwattro / GithubEventAnalysisWithNeo4j.markdown
Last active Oct 30, 2019
Github Events Analysis with Neo4j
View GithubEventAnalysisWithNeo4j.markdown

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.

@jexp
jexp / twitter_to_neo.rb
Last active Aug 29, 2015
Simple Ruby script to pull tweets from Twitter into Neo4j using Cypher
View twitter_to_neo.rb
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)
@jexp
jexp / install-graphgist.sh
Last active Mar 4, 2021
How to deploy a Neo4j Graph-Gist locally to not expose any data
View install-graphgist.sh
# 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
@prb
prb / maven_spark_magic.xml
Created May 12, 2014
Fragment of a pom.xml file for packaging separate worker and driver JARs for Spark.
View maven_spark_magic.xml
<!-- 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 / cypher.js
Created Jan 19, 2014
Javascript Snippet to simply access transactional Cypher Http endpoint of the Neo4j Server (see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html)
View cypher.js
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)) }
@tekiegirl
tekiegirl / ContributorCommunity.adoc
Last active Dec 28, 2015
Initial tests for the Contributor Community graph
View ContributorCommunity.adoc

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

@kbastani
kbastani / neo4j-cypher-delete-id-list.txt
Created Aug 14, 2013
Follow the steps in this gist to find and delete duplicate nodes on property and index in Neo4j graph database web admin console.
View neo4j-cypher-delete-id-list.txt
// 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
@entaroadun
entaroadun / gist:1653794
Created Jan 21, 2012
Recommendation and Ratings Public Data Sets For Machine Learning
View gist:1653794

Movies Recommendation:

Music Recommendation: