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 / 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.
@mikaelhg
mikaelhg / convert.sh
Last active December 30, 2024 03:42
Convert Natural Places SHP to geoparquet
# Convert Natural Places SHP to geoparquet
docker run -it --rm -u 1000:1000 -v `pwd`:/app -w /app ghcr.io/osgeo/gdal:alpine-normal-latest \
ogr2ogr -f geojson ne_10m_populated_places.geojson \
'/vsizip//vsicurl?referer=https://www.naturalearthdata.com/&url=https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip'
docker run -it --rm -u 1000:1000 -v `pwd`:/app -w /app ghcr.io/osgeo/gdal:alpine-normal-latest \
ogr2ogr -f parquet -lco COMPRESSION=ZSTD ne_10m_populated_places.geoparquet ne_10m_populated_places.geojson
# Filter

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.

@mikaelhg
mikaelhg / hq-whisper-ctranslate2.sh
Created August 3, 2024 14:58
High quality settings for whisper-ctranslate2
whisper-ctranslate2 --language en --model large-v3 \
--output_dir /tmp/transcript --output_format all \
--device cuda --compute_type float16 \
--beam_size 10 --patience 2 --vad_filter True \
--word_timestamps True --hallucination_silence_threshold 0.1 \
transcript.wav
@mikaelhg
mikaelhg / 01_README.md
Created August 1, 2024 05:07
XFCE4 disappearing Super keys

~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

xfsettingsd --replace

... or if you want to run it in foreground in terminal XFSETTINGSD_DEBUG=1 xfsettingsd --replace --no-daemon

@mikaelhg
mikaelhg / urllib3.md
Created March 7, 2024 20:31
OpenSearch lib resource consumption testing
@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 / 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)
internal inline fun <reified T : Any> T.getClassLogger() : java.util.logging.Logger
= java.util.logging.Logger.getLogger(T::class.java.name)
@mikaelhg
mikaelhg / runrandr.sh
Created February 2, 2023 12:33
Use xrandr to reset screens
xrandr --output eDP --auto
xrandr --output HDMI-A-0 --auto