Skip to content

Instantly share code, notes, and snippets.

Avatar

Oleg Lavrovsky loleg

View GitHub Profile
@loleg
loleg / santa.py
Created Dec 6, 2020 — forked from will-bainbridge/santa.py
Secret Santa script
View santa.py
#!/usr/bin/python3
"""
Ye olde Secret Santa script based on https://gist.github.com/will-bainbridge/a4666a196fb5833cf37035647b74c064
You will need to prepare a "people file", which is in CSV format (UTF-8, comma delimited) and has the following columns (without a header row)
Name, E-mail, Extra content 1, Extra content 2
We used the postal address as extra content 1 and a link to Google Street View as extra content 2. Then you can specify a plain text message file which includes %s for the buyer name, recipient name, recipient extra 1, and recipient extra 2 (in that order!). For example:
View Oleg @ OpenDataBeer 12.md
title tags description slideOptions
Oleg @ OpenDataBeer 12
dribdat
View the slide with "Slide Mode".
theme
white

OpenDataBeer logo

@loleg
loleg / grab-commons-images-sh
Last active Nov 30, 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
#
@loleg
loleg / corona-mix.ino
Created Oct 30, 2020
A zombie remix of tamberg's SwissCovid-detector and ganda1f's PartyNoise-detector
View corona-mix.ino
// Just getting my hands dirty with Arduino! Please don't be upset ...
/* Sources:
*
* https://github.com/gand417/mz2020_audio/blob/main/mz2020_audio.ino
* https://github.com/make-zurich/makezurich-hardware-intro/blob/master/Arduino/Neno33BleSense_CoronaAppScanner/Neno33BleSense_CoronaAppScanner.ino
*/
#include <Adafruit_NeoPixel.h>
#include <ArduinoBLE.h>
@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