This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Requirements: | |
# pip3 install spacy graphviz | |
# python3 -m spacy download en_core_web_lg | |
# | |
import spacy | |
from graphviz import Digraph | |
nlp = spacy.load('en_core_web_lg') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select ?x (count(*) as ?c) { | |
[] <PROPERTY_URI> ?o . | |
optional { | |
?o a/rdfs:subClassOf+ ?class . | |
?class rdfs:subClassOf owl:Thing | |
} | |
bind(if( | |
isuri(?o), | |
?class, | |
datatype(?o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ntriples=$1 | |
tsv=$2 | |
sed -n $'s/^<\([^ ]*\)> <\([^ ]*\)> <\([^ ]*\)> \.$/\\1\t\\2\t\\3/p' $ntriples > $tsv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list all differences between two entities, filtered by certain properties | |
SELECT * WHERE { | |
{ | |
<http://dbpedia.org/resource/Nevada> ?p ?o1 | |
MINUS { <http://dbpedia.org/resource/Lincoln_County,_Nevada> ?p ?o1 } | |
} UNION { | |
<http://dbpedia.org/resource/Lincoln_County,_Nevada> ?p ?o2 | |
MINUS { <http://dbpedia.org/resource/Nevada> ?p ?o2 } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl -s https://lod-cloud.net/lod-data.json | jq '.[] | .triples' | sed -e $'s/"//g' | awk '{s+=$1} END {printf "%d\n", s}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
python3 -m venv env | |
source env/bin/activate | |
pip3 install ipykernel jupyter | |
python3 -m ipykernel install --user --name=env | |
jupyter notebook | |
# for 'requirements.txt': | |
# pip3 freeze > requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import http, json, base64 | |
from urllib.request import Request, urlopen | |
from urllib.parse import urlencode | |
from urllib.error import HTTPError | |
from time import time | |
class PySparql(): | |
def __init__(this, endpoint, username=None, password=None, buffer_size=10000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from rdflib.plugins.parsers.ntriples import NTriplesParser, Sink | |
filename = 'input.nt' | |
class MySink(Sink): | |
def triple(self, s, p, o): | |
pass | |
sink = MySink() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# USAGE: | |
# sudo ./add_swap.sh 4G | |
# | |
# SOURCE: | |
# https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/ | |
# | |
fallocate -l $1 /swapfile | |
chmod 600 /swapfile |
NewerOlder