Skip to content

Instantly share code, notes, and snippets.

View white-gecko's full-sized avatar

Natanael Arndt white-gecko

View GitHub Profile
@white-gecko
white-gecko / docker-compose
Created March 8, 2024 20:45
A replacement for docker-compose to use podman-compose
#!/bin/sh
if [ $# -eq 1 ] && [ "$1" = "kill" ]; then
podman-compose kill --all
exit 0
fi
if [ "$1" = "rm" ]; then
podman-compose kill --all
if [ "$2" = "-v" ] ; then
podman volume rm --all
fi
for i in $( git log --oneline <path_to_file_in_repo> | awk '{print $1}' ); do git show --raw $i | grep <path_to_file_in_repo> | awk '{print $4}' | xargs git show --raw | diff -w <path_to_my_file> - | grep "^>" | wc -l ; echo $i ; done
#!/usr/bin/env python3
import timeit
REP = 100
def perf_set():
for i in range(REP):
'a' in {'a', 'b', 'c', 'd', 'e'}
'c' in {'a', 'b', 'c', 'd', 'e'}
ComparableGraph
-> Menge von AtomicGraph
ConjunctiveGraph
-> Menge von ComparableGraph
-> Menge von AtomicGraph
=> Blank Node Scope beschränkt auf einen Graph
ConjunctiveGraph
-> Menge von AtomicDatasets
@white-gecko
white-gecko / dataset-construct-literal.sparql
Last active November 13, 2019 19:01
If you want to query a complete dataset with a single construct query.
PREFIX ex: <http://example.org/>
CONSTRUCT {
?s ?p ?o .
?g a ex:Graph ;
ex:hasData ?datalit .
} WHERE {
{
?s ?p ?o .
} UNION {
@white-gecko
white-gecko / example.py
Last active November 7, 2019 16:11
sqlite python example
#!/usr/bin/env python3
# starting with https://docs.python.org/3.8/library/sqlite3.html
import sqlite3
conn = sqlite3.connect('example.db')
c = conn.cursor()
c.execute("DROP TABLE IF EXISTS stocks")
c.execute("DROP TABLE IF EXISTS stuff")
@white-gecko
white-gecko / hashcmptest.py
Created October 31, 2019 12:25
Play around with a hashable and comparable object in python
#!/usr/bin/env python3
class mE():
def __init__(self, value):
self.v = value
# we need __hash__ and __eq__ for the set
def __hash__(self):
# the maximum length of hash is restricted by the platform:
# https://docs.python.org/3/reference/datamodel.html#object.__hash__
@white-gecko
white-gecko / makeBackup.sh
Created March 12, 2018 20:51
aksw.org backup script
#!/usr/bin/env bash
cd /home/seebi/backups
echo "dump_one_graph ('http://aksw.org/', '/tmp/akswdump_', 1000000000);" | isql-vt -U dba -P "the_password" >/dev/null
cp /tmp/akswdump_000001.ttl aksw.org.ttl
rapper -q -i turtle -o turtle /tmp/akswdump_000001.ttl >aksw.org.ttl
rapper -q -i turtle -o ntriples aksw.org.ttl | sort >aksw.org.nt
echo "dump_one_graph ('http://localhost/OntoWiki/Config/', '/tmp/owconfigdump_', 1000000000);" | isql-vt -U dba -P "the_password" >/dev/null
rapper -q -i turtle -o turtle /tmp/owconfigdump_000001.ttl >owconfig.ttl
rapper -q -i turtle -o ntriples owconfig.ttl | sort >owconfig.nt
"""Untill https://github.com/RDFLib/rdflib/pull/807 is merged and released."""
from rdflib import Graph, BNode, URIRef
from six.moves.urllib.parse import urljoin
"""requirements.txt:
rdflib>=4.2.2
"""
def bNodeSkolemize(self, authority=None, basepath=None):
@white-gecko
white-gecko / datei
Last active May 4, 2016 18:38
Git merges
A
B
C
D