Skip to content

Instantly share code, notes, and snippets.

View pebbie's full-sized avatar

Peb Ruswono Aryan pebbie

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import os.path as path
import sys
import traceback
import json
import zipfile
from urllib.request import urlopen
import shutil
import argparse
@pebbie
pebbie / vis_timeline_with_arror_first_test.html
Created December 17, 2021 11:30 — forked from JimmyCheng/vis_timeline_with_arror_first_test.html
This is test to see how difficult it would be to add multiple arrows to vis.js timeline view. Can be previewed with https://gistpreview.github.io/?4a6a6feba553e2cbe0396486f157b7bb
<!DOCTYPE html>
<html>
<head>
<title>Timeline | Group example, with an arrow</title>
<style>
body,
html {
font-family: arial, sans-serif;
@pebbie
pebbie / sparqlqueryviz.py
Last active August 30, 2022 02:53
visualize BGP triples in SPARQL query
import sys
import os.path as path
from rdflib import Namespace, XSD, RDF, RDFS, OWL
from rdflib.term import Variable, URIRef, BNode, Literal
from rdflib.plugins.sparql.parser import parseQuery
from rdflib.plugins.sparql.parserutils import prettify_parsetree
from rdflib.plugins.sparql import prepareQuery
from rdflib.paths import Path
import pprint
import pygraphviz as pgv
@pebbie
pebbie / export_vocab_from_wb.rq
Last active July 22, 2020 16:16
first attempt on trying to import/export existing vocabulary into/from wikibase. this query is for exporting annotated wikibase into RDF/OWL using OWL equivalentXX property
CONSTRUCT {
?ss ?pe ?oo .
?ss rdfs:label ?l
}
WHERE {
# original statement
?s ?p ?o.
?s rdfs:label ?l.
# we know there's an equivalent property for p

you need to execute these commands inside the quickstatements docker container (e.g. from terminal:

docker exec -it wikibase-docker_quickstatements_1 /bin/bash

) or replace the file using local file mapping in the docker-compose.yml recipe

  1. comment out the require_once line in the /var/www/html/magnustools/public_html/php/wikidata.php for example, using sed :

sed -i 's/require_once/\/\/require_once/' /var/www/html/magnustools/public_html/php/wikidata.php

"""
file: rdf2pandas.py
auth: Peb Ruswono Aryan
desc: import data in RDF Data Cube (assumed in particular shape) from Graph to Pandas DataFrame
"""
from rdflib import Graph, Namespace, RDF, RDFS
import pandas as pd
QB = Namespace('http://purl.org/linked-data/cube#')
DCT = Namespace('http://purl.org/dc/terms/')
"""
file: extract.py
auth: Peb Ruswono Aryan
date: 02.10.2019
desc: extract shapes (rectangle,triangle,circle) and raw attributes (color, location and size)
for used in kandinsky test
output tab separated values in the stdout
"""
import numpy as np
import cv2
@pebbie
pebbie / CMakeLists.txt
Last active March 4, 2019 14:46
CMake build file for building serd on Windows & VS2017 (might be incomplete but works for me)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
PROJECT(serd)
SET(MAJOR 0)
SET(MINOR 30)
SET(PATCH 0)
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
INCLUDE(CheckSymbolExists)
@pebbie
pebbie / web-servers.md
Created February 13, 2019 11:42 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000