Skip to content

Instantly share code, notes, and snippets.

Avatar

Oleg Lavrovsky loleg

View GitHub Profile
@loleg
loleg / lindas-sparql-example.r
Created Oct 23, 2020
An example of how to connect to the LINDAS service with the R package for SPARQL
View lindas-sparql-example.r
library(SPARQL)
endpoint <- "https://lindas.admin.ch/query"
rdf_query <- "
PREFIX : <http://voc.zazuko.com/zack#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX gont: <https://gont.ch/>
SELECT DISTINCT ?Haltestelle WHERE
{ GRAPH <https://linked.opendata.swiss/graph/FOT/didok> {
@loleg
loleg / corona-data.user.js
Created Oct 6, 2020
Light mode for Corona-Data.ch (Greasemonkey script)
View corona-data.user.js
// ==UserScript==
// @name Corona-Data.ch Light edition
// @description This adjusts the theme of the Swiss Covid-19 data visualization by Daniel Probst
// @version 0.0.1
// @grant GM.xmlhttpRequest
// @grant GM.addStyle
// @include https://www.corona-data.ch/*
// @include https://corona-data.ch/*
// ==/UserScript==
@loleg
loleg / models.py
Created Aug 17, 2020
Example Wagtail model with multiple contacts
View models.py
from django.db import models
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
from wagtail.core.models import Orderable
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
GENDER_CHOICES = (
@loleg
loleg / iotcam.py
Created Nov 7, 2015
Detects barcodes from a webcam stream using Python, zbar and CV2
View iotcam.py
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import sys
import cv2
import zbar
import Image
# Debug mode
DEBUG = False
@loleg
loleg / evalhack.css
Last active Jul 8, 2020
Dribdat customization for EvalHack
View evalhack.css
@import url(https://fonts.googleapis.com/css2?family=Lato);
body, p, div, span, h1, h2, h3, h4, h5, h6 { font-family:Lato }
/* Show event graphic, hiding detail info on event page */
.jumbotron.event-info * { display:none }
.jumbotron.event-info { background:url(https://blog.datalets.ch/workshops/2020/ipdet/IPDET_Hackathon-C.jpg) no-repeat center; background-size: contain; height:240px; width: 100% }
/* Customize the top navigation */
.navbar.navbar-light { background: #f7e94a; }
@loleg
loleg / submissions-#versus-virus-timeseries.csv
Created Apr 8, 2020
Submissions length over time at VersusVirus
View submissions-#versus-virus-timeseries.csv
Datestamp Length
04/05/2020 02:34:37 8915
04/05/2020 03:42:26 3203
04/05/2020 04:31:17 1039
04/05/2020 05:41:55 2865
04/05/2020 06:17:17 2355
04/05/2020 06:17:36 318
04/05/2020 06:18:45 379
04/05/2020 06:19:13 1896
04/05/2020 06:20:26 2219
View gist:7a6ee11bca35fd03e9de62664088b07a
Liebe Nachbarinnen und Nachbarn
Gerne bieten wir Ihnen während der derzeitigen Coronavirus-Pandemie unsere Unterstützung an.
Wir sind nicht krank und gehören nicht zur Risikogruppe. Wir können Ihnen unter anderem folgende Hilfeleistungen anbieten:
- Einkauf (z.B. Migros, Coop, Apotheke)
- Autofahrten
- Post
- Unterstützung bei technischen Problemen (z.B. Internet)
Sie erreichen uns am Besten per Telefon unter den untenstehenden Telefonnummern. Da viele von uns ab sofort von zuhause aus arbeiten (Homeoffice), sind wir mehrheitlich auch tagsüber gut erreichbar.
@loleg
loleg / graph.md
Created Mar 21, 2020
Open data flow
View graph.md

graph TD
X[My Data] -->|API / DSGVO| B(hack.opendata.ch)
A[OGD] -->|API / FOI| B
Y[
@loleg
loleg / grab-commons-images-sh
Last active Mar 18, 2020
Download images and metadata from a Wikimedia Commons category or results page
View grab-commons-images-sh
#!/bin/bash
#
# Download images from a Wikimedia Commons category
#
# Highest preview resolution and metadata in XML format will be saved in subfolders.
# Usage: execute this script on a Linux command line, providing the full URL to the category page.
#
# Shell tools required for this script: wget sed grep
#
You can’t perform that action at this time.