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 / cake.sh
Created April 15, 2026 15:27
Cake DOCSIS
#!/bin/bash
set -e
# Disable WiFi power management to get on the 160 MHz band
iw dev wlp1s0f0 set power_save off || true
# Load congestion control and virtual interface modules
modprobe tcp_bbr || true
modprobe sch_cake || true
modprobe -r ifb || true
@mikaelhg
mikaelhg / cuda-install.md
Last active January 27, 2026 17:55
Proper CUDA and cuDNN installation
date 2020-02-29
title Proper CUDA and cuDNN installation
tags
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

@mikaelhg
mikaelhg / convert.sh
Last active December 15, 2025 01:36
Convert Natural Places SHP to geoparquet
#!/bin/bash
function gdal() {
docker run -i --rm -u $(id -u):$(id -g) \
-v "$(pwd)":/app \
-w /app \
ghcr.io/osgeo/gdal:alpine-normal-latest \
"$@"
}
@mikaelhg
mikaelhg / 01_README.md
Last active June 17, 2025 18:48
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 / MILTER_6_SPEC.md
Created June 9, 2025 17:09
Milter 6 specification

This document specifies the Sendmail Milter protocol, version 6, integrating the version 2 base protocol with subsequent extensions.

1. General

1.1. Notation

All integer types are transmitted in network byte order (big-endian). Data is byte-aligned.

  • uint32: 32-bit unsigned integer.
  • uint16: 16-bit unsigned integer.
  • char: 8-bit character/byte.
@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 / 01_pkcs12-cacerts-workaround.sh
Last active January 17, 2025 07:11
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 / 02_task.txt
Created January 2, 2025 18:19
3-shot IBM Granite 3.1 3B MoE A800M code formatting task
You are a C code formatter. Format the given C code according to the following rules:
1. Use 4 spaces for indentation.
2. Place opening braces '{' on the same line as the statement.
3. Place closing braces '}' on a new line, aligned with the start of the statement.
4. Add a space after keywords like `if`, `for`, `while`, `switch`, and before the opening parenthesis.
5. Add a space on either side of binary operators (e.g., +, -, =, <, >).
6. Do not add spaces inside function argument lists except after commas.
7. Add a newline after each semicolon, except for loop initialization and update parts.
8. Use a single newline between functions.

So a new 802.11ax Mediatek mt7621u USB Wifi device initially didn't work.

It required blacklisting the btusb kernel module to get it to work as a Wifi device.