Skip to content

Instantly share code, notes, and snippets.

Natanael Arndt white-gecko

Block or report user

Report or block white-gecko

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
View quit-blank-sketchbook
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 Nov 13, 2019
If you want to query a complete dataset with a single construct query.
View dataset-construct-literal.sparql
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 Nov 7, 2019
sqlite python example
View example.py
#!/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 Oct 31, 2019
Play around with a hashable and comparable object in python
View hashcmptest.py
#!/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 Mar 12, 2018
aksw.org backup script
View makeBackup.sh
#!/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
View skolemize.py
"""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 / docker-env
Created Aug 7, 2015
Docker environment management with $DOCKER_ENV
View docker-env
#!/bin/bash
list ()
{
echo "local"
echo "remote1"
}
env_remote1 ()
{
export DOCKER_HOST="remote1.org:2375"
@white-gecko
white-gecko / ddict.py
Created Jul 8, 2015
Python Default Dictionary of Dictionaries
View ddict.py
#! /usr/bin/env python3
from collections import defaultdict
def ddict ():
return defaultdict(ddict)
def ddict2dict(d):
for k, v in d.items():
if isinstance(v, dict):
@white-gecko
white-gecko / gecko.zsh-theme
Last active Aug 29, 2015
My zsh theme (you have to place it in ~/.oh-my-zsh/themes/ and change ZSH_THEME to gecko in your .zshrc)
View gecko.zsh-theme
# this theme was build be taking some code and impressions from mortalscumbag, intheloop, crcandy and bureau
bureau_git_branch () {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "${ref#refs/heads/}"
}
bureau_git_status () {
_INDEX=$(command git status --porcelain -b 2> /dev/null)
You can’t perform that action at this time.