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
mikaelhg / urllib3.md
Created March 7, 2024 20:31
OpenSearch lib resource consumption testing
@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 / 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 / 01_pkcs12-cacerts-workaround.sh
Last active August 4, 2023 06:01
Workaround for java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
# Ubuntu 18.04 and various Docker images such as openjdk:9-jdk throw exceptions when
# Java applications use SSL and HTTPS, because Java 9 changed a file format, if you
# create that file from scratch, like Debian / Ubuntu do.
#
# Before applying, run your application with the Java command line parameter
# java -Djavax.net.ssl.trustStorePassword=changeit ...
# to verify that this workaround is relevant to your particular issue.
#
# The parameter by itself can be used as a workaround, as well.
@mikaelhg
mikaelhg / SystemProperties.kt
Last active July 13, 2023 20:38
Kotlin utility class for easily fetching standard system props
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
mikaelhg / README.md
Created July 10, 2020 13:40
Using Packer to provision Amazon Linux 2 without seed.iso

(I also reported this to AWS: awsdocs/amazon-ec2-user-guide#123)

The "Running Amazon Linux 2 as a virtual machine onpremises" page describes a fairly cumbersome way of running Amazon Linux 2 in local virtual machines through using various tools to provision ISO9660 seed.iso files just to serve the VM instance two small data files.

It would be great it the documentation also pointed out that since the VM provisioning is being done with cloud-init, and the image has configured a fairly extensive datasource_list: [ NoCloud, AltCloud, ConfigDrive, OVF, None ] which starts with NoCloud, that NoCloud also allows you to serve these files over HTTP.

There are two easy ways of using network configuration instead of seed.iso. Either you tell GRUB to add a parameter to the kernel boot configuration, or you tell KVM/VMWare/Virtualbox to set the virtual machine's SMBIOS value to something which cloud-init's NoCloud understands.

The documentation page https://cloudinit.readthedocs.

@mikaelhg
mikaelhg / zstd_compress.py
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)
@mikaelhg
mikaelhg / cuda-install.md
Last active June 6, 2023 15:29
Proper CUDA and cuDNN installation
date title tags
2020-02-29
Proper CUDA and cuDNN installation
tech

You're here, so you're probably already hurting because of CUDA and cuDNN compatibility, and I won't have to motivate you, or explain why you'd want to have standalone CUDA and cuDNN installations, if you're going to develop using Tensorflow in the long term.

1. Download your CUDA runfile (local) packages

internal inline fun <reified T : Any> T.getClassLogger() : java.util.logging.Logger
= java.util.logging.Logger.getLogger(T::class.java.name)