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
#!/bin/bash
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_SCREEN_SCALE_FACTORS=2
/usr/bin/synclient TapButton3=2 &
@mikaelhg
mikaelhg / 01_README.md
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
mikaelhg / README.md
Last active December 30, 2023 22:24
Get started with Protomaps single-file static map hosting

Get started with Protomaps single-file static map hosting

Build maps

Planetiler downloads data files for you automagically.

java -jar planetiler.jar --download --area=finland --output=finland.pmtiles
@mikaelhg
mikaelhg / pno_2022_download.sh
Last active October 19, 2022 06:24
Postinumeroalueet 2022 query and conversion to GeoJSON (Paavo)
#!/bin/bash
wget -O pno_2022.zip \
'https://geo.stat.fi/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=postialue:pno_2022&outputFormat=SHAPE-ZIP'
unzip pno_2022.zip
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
mikaelhg / keybindings.json
Created August 27, 2022 12:34
Some VS Code keybindings
[
{ "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
mikaelhg / tracking.py
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
@mikaelhg
mikaelhg / journal_listener.py
Last active August 7, 2023 09:50
rtw89 CTRL-EVENT-BEACON-LOSS workaround
#!/bin/env python
# journalctl -u wpa_supplicant -f -o json | python event_listener.py
import json
import sys
import subprocess
__BEACON_LOSS = 'CTRL-EVENT-BEACON-LOSS'
@mikaelhg
mikaelhg / build.sh
Created August 7, 2022 12:49
tippecanoe static build
CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 \
CFLAGS="-static --ld-path=/usr/bin/ld.lld-14" \
CXXFLAGS="-static --ld-path=/usr/bin/ld.lld-14" \
LDFLAGS="-static" \
make -j16
@mikaelhg
mikaelhg / empty_favicon_data_link.html
Created December 18, 2021 08:28
Empty favicon.ico data link embedded in HTML page
@mikaelhg
mikaelhg / ubuntu_2104_gcc_alternatives.sh
Created May 8, 2021 20:27
Script for bringing all of the GCC versions on Ubuntu 21.04 into the alternatives system
#!/bin/sh
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8