Skip to content

Instantly share code, notes, and snippets.

View jindrichmynarz's full-sized avatar

Jindřich Mynarz jindrichmynarz

View GitHub Profile
@jindrichmynarz
jindrichmynarz / tech4good_dub.rb
Created December 14, 2021 20:59
Live-coding in Sonic Pi at Tech4Good online meet-up
### Sonic Pi
### The Live Coding Music Synth for Everyone
### https://sonic-pi.net
use_debug false
use_bpm 80
drum_mix = 1
bass_mix = 1
synth_mix = 1
@jindrichmynarz
jindrichmynarz / noise_meditation_in_sonic_pi.rq
Created November 21, 2021 11:33
Live coding noise in Sonic Pi
use_debug false
instruments = 1
drums = 1
live_loop :clock do
sleep 1
end
noise_cutoffs = range(100, 120, 0.1).reflect
@jindrichmynarz
jindrichmynarz / typing_the_glam.rb
Created March 2, 2021 10:16
Typing the glam: a tribute to Apollo 440's Glam in Sonic Pi
# A tribute to
#
# Apollo 440: Glam
#
# Dedicated to my Dad
#
# (with whom I bought this on a CD back in the 1990s)
use_debug false
use_bpm 130
@jindrichmynarz
jindrichmynarz / indirect_wikidata.rq
Created April 22, 2020 06:25
Construct indirect Wikidata links used by DBpedia
# Run at the German DBpedia SPARQL endpoint: http://de.dbpedia.org/sparql
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?dbpedia
WHERE {
BIND (<http://www.wikidata.org/entity/Q1418856> AS ?wikidata)
BIND (strafter(str(?wikidata), "http://www.wikidata.org/entity/") AS ?qid)
BIND (iri(concat("http://wikidata.dbpedia.org/resource/", ?qid)) AS ?indirect_wikidata)
?dbpedia owl:sameAs ?indirect_wikidata .
@jindrichmynarz
jindrichmynarz / wikitrends.py
Last active July 7, 2019 18:42
Displays a graph of the most visited entities in Wikipedia, in Bash and Python versions
#!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentTypeError
from datetime import date, datetime, timedelta
import json
import re
from string import Template
import urllib.parse
import urllib.request
import webbrowser
@jindrichmynarz
jindrichmynarz / count_class_instances_from_lod_laundromat.sh
Last active August 18, 2018 09:11
Count class instances from LOD Laundromat
#!/usr/bin/env bash
#
# A demo script that retrieves counts of class instances from LOD Laundromat datasets
# Usage:
# Reads a list of newline separated class IRIs either from its first argument or standard input.
# $ count_class_instances_from_lod_laundromat.sh < classes.txt
#
# Caveat:
# Since we use an old-school shell script, class IRIs that contain special characters,
# like %-encoding or commas will break the CSV output.
@jindrichmynarz
jindrichmynarz / obfuscate_rdf.ru
Created June 5, 2018 13:26
Basic obfuscation of RDF data using SHA hashes + UUID salt
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
###############
# Create salt #
###############
INSERT {
GRAPH :mappings {
@jindrichmynarz
jindrichmynarz / cbd.rq
Created February 24, 2018 18:20
Recursive concise bounded description
# SPARQL 1.1 implementation of concise bounded description (<https://www.w3.org/Submission/CBD>).
PREFIX : <http://example.com/>
PREFIX non: <http://non/>
CONSTRUCT {
:resource ?p1 ?r1 .
?r2 ?p2 ?r3 .
}
WHERE {
@jindrichmynarz
jindrichmynarz / split_urls.ru
Created August 22, 2017 17:32
Split strings in pure SPARQL
# Solution from: <http://answers.semanticweb.com/questions/19162/split-and-trim-strings-in-sparql/27544>
PREFIX schema: <http://schema.org/>
DELETE {
?s schema:url ?urls .
}
INSERT {
?s schema:url ?url .
}
@jindrichmynarz
jindrichmynarz / generate_rdf.rq
Created April 7, 2017 09:44
Generate 0 to 10 random RDF triples
PREFIX : <http://localhost/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
CONSTRUCT {
?s ?p ?o .
}
WHERE {
# Generate 0 to 10 triples
VALUES ?n { 0 1 2 3 4 5 6 7 8 9 10 }