Skip to content

Instantly share code, notes, and snippets.

@vidarh
vidarh / closures-basic.c
Created December 18, 2009 12:10
A number of ways to implement closures in C, in preparation of an upcoming blog post
#include <stdio.h>
#include <stdlib.h>
struct closure {
void (* call)(struct closure *);
int x;
};
@erikcorry
erikcorry / aliasing-slices.go
Created March 24, 2021 09:43
Golang slices sometimes alias their underlying array, and sometimes don't.
// Prints false, false, false, true, false, true, true, false, true.
package main
func main() {
for i := 0; i < 10; i++ {
println(doesItAlias(i))
}
}
package main
func main() {
// Two new vars, with :=.
x, y := returns_one_and_two()
print("x = ", x, "\n") // 1
print("y = ", y, "\n") // 2
// One of the vars is new, use := for both.
y, z := returns_one_and_two()

PipeWire BlueZ5 AAC Codec Builder (Debian Trixie)

This gist provides a script to build and package the AAC Bluetooth codec plugin (libspa-codec-bluez5-aac.so) for PipeWire on Debian trixie.

Debian does not ship AAC support in PipeWire by default (due to licensing), but the library can be built from source if you have libfdk-aac available. This script automates the whole process using Docker and produces a .deb that installs the codec in the correct multiarch path.

Ubiquiti UVC G3 standalone setting bug

When resetting the camera, the setup wizard asks if the camera is set to NVR or Standalone mode. If standalone mode is selected the setting is not stored and the camera is operating in the NVR-mode. This can not be changed from the web UI after the initial setup. This is how I managed to get the camera to standalone mode.

  1. Connect to the camera via SSH
  2. Edit configuration file /tmp/system.cfg and change parameter device.managed_mode from 1 to 0
  3. Save file
  4. Apply settings with command $cfgmtd -f /tmp/system.cfg -w