Skip to content

Instantly share code, notes, and snippets.


Oleg Lavrovsky loleg

View GitHub Profile
loleg / shuffle.js
Last active Apr 3, 2022
Populates a column of random numbers for shuffling the order of an Airtable
View shuffle.js
// Select a table containing a "Sort Order" number column
const TABLE_NAME = "<Your Table Name Here>"
// A time limit comfortably within the allowable script runtime
const MAX_TIME = 25;
// Maximize shuffle within the time limit
const startTime = new Date();
function timeElapsed() {
const endTime = new Date().getTime();
loleg / geoadmincoding.js
Last active Jul 18, 2022
Airtable script for geocoding addresses using the swisstopo REST API
View geoadmincoding.js
/* Geocoding utility script by @loleg
* Latest version:
* - fills location coordinates based on an "Address" field
* - uses the open data API service of swisstopo (Switzerland only)
* - currently auto-throttled by Airtable, with fetch limits
* - retries continuously to let you fix addresses in your table
* - add this to a "create record" automation and also limit by time
* Required fields:
loleg / DDA.p5.js
Created Jan 24, 2022
The simplest line drawing algorithm
View DDA.p5.js
* @name DDA graphics algorithm
* @description A simple implementation of line rasterization using the Digital differential analyzer.
* Press the mouse button on any two points to draw a line. A color will be picked at random.
* See
let i = x1 = y1 = x2 = y2 = dx = dy = step = 0;
let pickStart = pickEnd = false;
loleg /
Created Nov 13, 2021
Combine geodata referenced by EGID (building identifier) #DataHackdaysBE
import csv, io
# Configuration
input_addresses = "Gebaeudeadressen_1636760957021_53445 - Gebäudeadressen.csv"
egidcol_addresses = "Eidg. Gebäude-ID (EGID)"
input_opendata = "V20211111.csv"
egidcol_opendata = "egid"
output_filename = "combined.csv"
# Preload address file
loleg / emojipedia-cheatsheet.js
Created Jun 26, 2021
Console script to generate an Emoji cheatsheet
View emojipedia-cheatsheet.js
1. Go to any emoji list page on Emojipedia, e.g.
2. Scroll down until every icon has loaded
3. Run this script in your console
4. Print!
$('li a img').each(function() { nm = $(this).attr('title'); $(this).parent().append('<ttl>' + nm + '</ttl>') });
loleg /
Created Dec 6, 2020 — forked from will-bainbridge/
Secret Santa script
Ye olde Secret Santa script based on
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
title tags description slideOptions
Oleg @ OpenDataBeer 12
View the slide with "Slide Mode".

OpenDataBeer logo

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:
#include <Adafruit_NeoPixel.h>
#include <ArduinoBLE.h>
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
endpoint <- ""
rdf_query <- "
PREFIX rdfs: <>
PREFIX wdt: <>
PREFIX gont: <>
{ GRAPH <> {
loleg / corona-data.user.js
Created Oct 6, 2020
Light mode for (Greasemonkey script)
View corona-data.user.js
// ==UserScript==
// @name 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*
// @include*
// ==/UserScript==