Skip to content

Instantly share code, notes, and snippets.

View hmelder's full-sized avatar

Hugo Melder hmelder

View GitHub Profile
@hmelder
hmelder / README.md
Created September 15, 2026 15:37
NSURLSessionWebSocketTask Unit Tests

Minimal Unit Testing for the Websocket implementation in Foundation Framework

This test suite was written by me to understand the behaviour and side-effects of NSURLSessionWebSocketTask. This was done because the official API documentation is completely useless.

There are two files in this gist:

  1. main.m: The minimal unit test that only depends on Foundation.framework
  2. main.py: The Websockets unit test server, based on the Python Websockets module

Findings:

@hmelder
hmelder / android-emulator-compilation.md
Last active August 27, 2025 10:26
Compiling the Android Emulator

If you follow the official instructions from here, you will end up downloading over 100 GB of system images. This is due to this line in the repo manifest:

<!-- Test infrastructure uses these -->
  <project path="prebuilts/android-emulator-build/system-images" name="platform/prebuilts/android-emulator-build/system-images" revision="main" clone-depth="1" />

Instead of emu-master-dev, select the emu-master-qemu branch to only pull dependencies for building the emulator.

If you are targeting aarch64-linux, cross-compile from an x86_64 machine, as there are no prebuild toolchains that run natively on this target. I recommend just using the latest Ubuntu LTS or Debian, as this is what the python script expects.

@hmelder
hmelder / hid-spi.dts
Created August 18, 2025 17:51
Surface Pro 11 Digitizer DTS Attempts
// SPDX-License-Identifier: BSD-3-Clause
/*
* Copyright (c) 2025 Hugo Melder <contact@hugomelder.com>
*/
/* Enable HID over SPI */
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
@hmelder
hmelder / README.md
Last active October 7, 2023 16:28
GStreamer Interaudio* Issue

This is an isolated example of a GStreamer audio issue that exists when using interaudio* elements.

  • OS: NixOS 23.05.4076.8a4c17493e5c (Stoat) aarch64
  • Kernel: 6.1.55
  • CPU: Apple M1 Pro (Virt)
  • Memory: 8.0GiB
  • gst-launch-1.0 version: 1.22.5
  • GStreamer: 1.22.5

Building

@hmelder
hmelder / Building_Infer_Alpine_aarch64.md
Last active July 20, 2023 23:29
Building an infer release on alpine linux

Requirements

  • Alpine Virtual Machine or similar
  • Time

Install Development Dependencies:

apk add alpine-sdk bash patchelf autoconf automake make pkgconf git openjdk17

Installing opam and OCaml

@hmelder
hmelder / pipe.sh
Created January 17, 2021 11:31
(Librespot -> ffplay/vlc) Pipe librespot raw pcm s16le stream (Librespot -> ffplay/vlc)
#!/bin/bash
# This is the recommended option. ffplay playback controls are working perfectly.
# Seeking/Song-skipping works too.
librespot -n "Librespot Speaker" -b 320 --backend pipe | ffplay -f s16le -ar 44.1k -ac 2 -
# Not recommended. VLC playback controls are broken and spotify-connect remote control does not work either. (VLC macOS Bundle)
#librespot -n "Librespot Speaker" -b 320 --backend pipe | /Applications/VLC.app/Contents/MacOS/VLC -I dummy --demux=rawaud --rawaud-channels=2 --rawaud-samplerate=44100 -