Skip to content

Instantly share code, notes, and snippets.

View bcdonadio's full-sized avatar
💼
Hard at work

Bernardo Donadio bcdonadio

💼
Hard at work
View GitHub Profile
@bcdonadio
bcdonadio / static_cgo.md
Last active January 27, 2023 13:50 — forked from zmb3/static_cgo.md
Compile static binaries for Go programs that leverage Cgo.

In order to compile a fully static binary when using Cgo you'll need to use another standard C library like musl instead of the GNU libc, because Canonical and others simply decided that most of the whole damn point of using Golang, which is having a multi-platform and almost universal build toolchain, is simply not to their tastes.

A solution then is to do this messy thingy:

apt update && apt build-dep -y musl
MUSL_VER=2.2.2 # Matches Ubuntu 22.04 "Jammy" as of 2023-01-06
DIR=$(mktemp -d)
pushd $DIR
wget https://www.musl-libc.org/releases/musl-${MUSL_VER}.tar.gz -O musl.tar.gz
@bcdonadio
bcdonadio / link_multiple_devices.yaml
Last active May 30, 2023 04:45 — forked from aderusha/link_multiple_devices.yaml
Select multiple entities to link their on/off state. If any selected entity is turned on or off, the other selected entities will be sent a matching on or off command.