Skip to content

Instantly share code, notes, and snippets.

View mikaelhg's full-sized avatar
Working from home

Mikael Gueck mikaelhg

Working from home
View GitHub Profile
mikaelhg / SystemProperties.kt
Last active July 13, 2023 20:38
Kotlin utility class for easily fetching standard system props
View SystemProperties.kt
package io.mikael
import java.time.LocalDate
object SystemProperties {
operator fun get(key: String): String? = System.getProperty(key)
fun get(key: String, default: String): String = get(key) ?: default
mikaelhg /
Created June 29, 2023 13:46
Setting zstd compression level to 22 with pandas and parquet
import pandas as pd
df = ...
df.to_parquet("foobar.parquet.zst", compression='zstd', compression_level=22)
View logging.kt
internal inline fun <reified T : Any> T.getClassLogger() : java.util.logging.Logger
= java.util.logging.Logger.getLogger(
mikaelhg /
Created February 2, 2023 12:33
Use xrandr to reset screens
xrandr --output eDP --auto
xrandr --output HDMI-A-0 --auto
View xsessionrc
/usr/bin/synclient TapButton3=2 &
mikaelhg /
Last active November 14, 2022 12:19
Hetzner + Caddy + GoToSocial

Zero to self-hosted Fediverse presence

With Hetzner + Caddy + GoToSocial.

1. You probably already have some way to host content on the Internets, but if not, get a $5 Hetzner cloud server. I just put it on my home server, a old repurposed thin client.

2. Install Caddy.

mikaelhg /
Last active September 19, 2022 09:13
Get started with Protomaps single-file static map hosting

Get started with Protomaps single-file static map hosting

Install tools

Install Python 3 with pip, and Java 11+ - I used 18.

pip install --user --upgrade pmtiles
mikaelhg /
Last active October 19, 2022 06:24
Postinumeroalueet 2022 query and conversion to GeoJSON (Paavo)
wget -O \
ogr2ogr -f GeoJSON -s_srs pno_2022Polygon.prj -t_srs EPSG:4326 \
-lco RFC7946=YES pno_2022.geojson.iso88591 pno_2022Polygon.shp
iconv -f iso-8859-15 -t utf-8 < pno_2022.geojson.iso88591 > pno_2022.geojson
pigz -k pno_2022.geojson
mikaelhg / keybindings.json
Created August 27, 2022 12:34
Some VS Code keybindings
View keybindings.json
{ "key": "alt+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "alt+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "alt+3", "command": "workbench.action.openEditorAtIndex3" },
{ "key": "alt+4", "command": "workbench.action.openEditorAtIndex4" },
{ "key": "alt+5", "command": "workbench.action.openEditorAtIndex5" },
{ "key": "alt+6", "command": "workbench.action.openEditorAtIndex6" },
{ "key": "alt+7", "command": "workbench.action.openEditorAtIndex7" },
{ "key": "alt+8", "command": "workbench.action.openEditorAtIndex8" },
{ "key": "alt+9", "command": "workbench.action.openEditorAtIndex9" },
mikaelhg /
Created August 21, 2022 19:37
Five minute pedestrian tracking with norfair and yolov5 from Torch Hub
#!/bin/env python
import argparse
from typing import List
import numpy as np
import torch
import norfair
from norfair import Detection, Tracker, Video