Skip to content

Instantly share code, notes, and snippets.

View ghirardinicola's full-sized avatar

Nicola Ghirardi ghirardinicola

View GitHub Profile
@jexp
jexp / bulk-neo4j-import-original.sh
Last active May 10, 2021 20:29
Panama Papers Import Scripts for Neo4j
export NEO4J_HOME=${NEO4J_HOME-~/Downloads/neo4j-community-3.0.1}
if [ ! -f data-csv.zip ]; then
curl -OL https://cloudfront-files-1.publicintegrity.org/offshoreleaks/data-csv.zip
fi
export DATA=${PWD}/import
rm -rf $DATA
Year,Picture,Studio,Box Office,Box Office MM,Noms,Wins,Realease Date,ProdBudget,Running Time,Genre,MPAA
2014,Birdman,FoxS,"$42,085,397","$42,000,000",9,4,10/17/14,"$18,000,000",119,Comedy / Drama,R
2013,12 Years a Slave,FoxS,"$56,671,993","$57,000,000",9,3,10/18/13,"$20,000,000",133,Drama,R
2012,Argo,WB,"$136,025,503","$136,000,000",7,3,10/12/12,"$44,500,000",120,Drama / Thriller,R
2011,The Artist,Wein.,"$44,671,682","$45,000,000",10,5,11/25/11,"$15,000,000",100,Comedy / Drama,PG-13
2010,The King's Speech,Wein.,"$135,453,143","$135,000,000",12,4,11/26/10,"$15,000,000",118,Drama,R
2009,The Hurt Locker,Sum.,"$17,017,811","$17,000,000",9,6,6/26/09,"$15,000,000",130,War,R
2008,Slumdog Millionaire,FoxS,"$141,319,928","$141,000,000",10,8,11/12/08,"$15,000,000",120,Drama,R
2007,No Country for Old Men,Mira.,"$74,283,625","$74,000,000",8,4,11/9/07,"$25,000,000",122,Drama,R
2006,The Departed,WB,"$132,384,315","$132,000,000",5,4,10/6/06,"$90,000,000",150,Drama,R
@dvcama
dvcama / dump_graphs
Last active July 5, 2019 02:36
virtuoso : export all graphs (triple dump) - virtuoso 6
CREATE PROCEDURE dump_graphs
( IN dir VARCHAR := '{WRITE HERE YOUR EXPORT PATH (allowed dir in virtuoso.ini)}' ,
IN file_length_limit INTEGER := 10000000000
)
{
DECLARE inx INT;
inx := 1;
SET ISOLATION = 'uncommitted';
FOR ( SELECT *
FROM ( SPARQL DEFINE input:storage ""
@darekkay
darekkay / trakt-backup.php
Last active May 1, 2024 15:30
Trakt.tv backup script
<?php
/*
Backup script for trakt.tv (API v2).
Live demo: https://darekkay.com/blog/trakt-tv-backup/
*/
// create a Trakt app to get a client API key: http://docs.trakt.apiary.io/#introduction/create-an-app
$apikey = "CLIENT_API_KEY";
@dfkoz
dfkoz / Movie Data
Last active August 29, 2015 14:02
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'net/http'
open('results.txt', 'wb') do |file|
(1 .. 94000).step(50).to_a.each do |start|
dir_url = 'http://www.imdb.com/search/title?at=0&sort=num_votes,desc&start=%s&title_type=tv_series' % start.to_s
puts dir_url
@ALenfant
ALenfant / yen_igraph.py
Last active October 26, 2022 19:39
Yen's algorithm for igraph, adapted from Wikipedia's pseudocode. The arguments are: graph: your igraph graph object (warning: the edge's id will change by using this function, so make a copy with gcopy if you want to keep them intact); source: source vertex; target: target vertex; num_k: number of shortest paths you want; weights: name of the ed…
def path_cost(graph, path, weights=None):
pathcost = 0
for i in range(len(path)):
if i > 0:
edge=graph.es.find(_source=path[i-1], _target=path[i])
if weights != None:
pathcost += edge[weights]
else:
#just count the number of edges
pathcost += 1
@cheme
cheme / MisperimentOfGraphDBRDF.md
Last active December 13, 2015 18:29
Notes on testing Neo4j and Virtuoso

Misgoals of this misperiment

The first goal to describe a little what would be call misperimenting with graphDB, RDF, and all fun stuff, without being to formal, and (I am very sorry for that) some misenglish everywhere.

And of course if it could help or inspire anyone for more useful tests it should be great (in did this a few month ago but have not time to pursue).

A graphDB for everything

There are not so many graphDB implementations, it is quiet odd considering the hype of NoSql idea and current social graph applications.

@jprante
jprante / jsonld.sh
Created December 7, 2012 10:03
JSON-LD in Elasticsearch
curl -XDELETE 'localhost:9200/jsonld'
curl -XPOST 'localhost:9200/jsonld'
curl -XPUT 'localhost:9200/jsonld/doc/1' -d '
{
"@context":
{
"dc": "http://purl.org/dc/elements/1.1/",
@tmcw
tmcw / foursquare_to_geojson.py
Created August 20, 2012 20:53
Turn your Foursquare Data Archive into a GeoJSON file
import glob, json
# this script loves this script
# https://gist.github.com/3350235
points = []
vids = set()
places = glob.glob("checkins/*.json")
for p in places:
@tmcw
tmcw / foursquare_archive.py
Created August 14, 2012 15:19
Simple Foursquare Checkins Archive of one User
import requests, os, glob, json, sys, webbrowser
you = 'self'
data = 'checkins'
try: os.mkdir(data)
except Exception: pass
cid = 'YOUR_CLIENT_ID'