Skip to content

Instantly share code, notes, and snippets.

🤖
Co-mentoring "A Neural QA Model for @dbpedia – Compositionality".

Tommaso Soru mommi84

🤖
Co-mentoring "A Neural QA Model for @dbpedia – Compositionality".
Block or report user

Report or block mommi84

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mommi84
mommi84 / add_swap.sh
Created Sep 12, 2019
Add swap memory on Ubuntu
View add_swap.sh
#!/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
@mommi84
mommi84 / extend.sh
Created Sep 10, 2019
Extend Ubuntu SSD in AWS
View extend.sh
# After having extended the SSD size via AWS console:
ubuntu@ip-172-31-46-157:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 18M 1 loop /snap/amazon-ssm-agent/1455
loop2 7:2 0 88.7M 1 loop /snap/core/7396
loop3 7:3 0 89M 1 loop /snap/core/7713
xvda 202:0 0 100G 0 disk
└─xvda1 202:1 0 50G 0 part /
@mommi84
mommi84 / download_files.sparql
Last active Nov 27, 2018
Updated list of DBpedia download files.
View download_files.sparql
#
# Endpoint: https://databus.dbpedia.org/repo/sparql
# Credits: https://github.com/JJ-Author
#
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
SELECT DISTINCT ?url WHERE {
?s dc:hasVersion ?version ;
@mommi84
mommi84 / sparql.py
Created Oct 31, 2018
SPARQL Query Execution in Python 2.7
View sparql.py
import urllib2, urllib, httplib, json
import sys
MAX_RESULTS = 10000
graph = ""
endpoint = ""
# Execute a SPARQL query.
def sparql_query(query):
@mommi84
mommi84 / bib4rash.py
Created Feb 1, 2018
Script to convert BibTeX files into RASH bibliography.
View bib4rash.py
#!/usr/bin/env python
import sys
import bibtexparser
reload(sys)
sys.setdefaultencoding("utf-8")
def fd(s):
if s[-1] != '.':
s += '.'
@mommi84
mommi84 / similarity_search.sparql
Last active Jan 20, 2018
SPARQL-based similarity search – Top entities of type X which share characteristics with Y
View similarity_search.sparql
SELECT ?s (count(?o) AS ?c) {
{
<Y> ?p ?o .
?s ?p ?o ; a <X>
} UNION {
?o ?p <Y> , ?s .
?s a <X>
}
} GROUP BY ?s ORDER BY DESC(?c) LIMIT 11
@mommi84
mommi84 / prodimem.py
Last active Dec 24, 2017
ProDiMem – Processor, disk, memory monitor for computations.
View prodimem.py
#!/usr/bin/env python
"""
ProDiMem - Processor, disk, memory monitor for computations.
Usage:
python prodimem.py [PID] [SECONDS]
Author:
Tommaso Soru <tom@tommaso-soru.it>
@mommi84
mommi84 / numbers_words.py
Created Nov 7, 2017
Conversion from integer numbers to English words.
View numbers_words.py
#!/usr/bin/env python
"""
Conversion from integer numbers to English words.
Author: Tommaso Soru <tom@tommaso-soru.it>
Example:
$ python numbers_words.py 3213213000312
threetrillionstwohundredsthirteenbillionstwohundredsthirteenmillionsthreehundredstwelve
@mommi84
mommi84 / foreachlod.py
Created Sep 27, 2017
For each (indexed) LOD dataset
View foreachlod.py
#!/usr/bin/env python
import sys
import urllib2, urllib, httplib, json
reload(sys)
sys.setdefaultencoding("utf-8")
ENDPOINT = "http://stats.lod2.eu/sparql"
GRAPH = ""
BUFFER = 10000
@mommi84
mommi84 / most-spec-types.sparql
Created Apr 2, 2017
Most specific types in SPARQL
View most-spec-types.sparql
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?s ?t2 WHERE {
?s a ?t2
MINUS {
?s a ?t1, ?t2 .
?t1 rdfs:subClassOf ?t2 .
}
}
You can’t perform that action at this time.