Skip to content

Instantly share code, notes, and snippets.

@zmb3
zmb3 / cloud-config.yaml
Created February 3, 2022 16:49
Multipass Candidate Review
packages:
- git
- wget
- build-essential
- tree
- protobuf-compiler
runcmd:
- [ wget, https://go.dev/dl/go1.17.5.linux-arm64.tar.gz ]
- [ sudo, tar, -C, /usr/local, -xzf, /go1.17.5.linux-arm64.tar.gz ]
@zmb3
zmb3 / static_cgo.md
Last active September 23, 2024 17:02
Compile static binaries for Go programs that leverage Cgo.

In order to compile a fully static binary when using Cgo you'll need to link in a C library like musl.

I find it convenient to have a Docker image ready for building these artifacts.

FROM golang
RUN wget https://musl.libc.org/releases/musl-1.2.5.tar.gz && \
   tar -xzf musl-1.2.5.tar.gz && \
   cd musl-1.2.5 && \
 ./configure --enable-static --disable-shared && \
#!/bin/bash
set -e
if [[ ($# -ne 3) && ($# -ne 2) ]]
then echo "wrong number of arguments:"
echo "create_cert sys_domain app_domain"
exit 1
fi
@zmb3
zmb3 / backup.sh
Last active November 8, 2019 00:26
Backup/Restore Concourse DB
# from Concourse DB VM:
# backup
cd /var/vcap/packages/postgresql_9.3/bin
./pg_dump -U vcap -d atc --format=c --schema-only --file=concourse-schema.sql
./pg_dump -U vcap -d atc --format=c --data-only --file=concourse-data.sql
# restore
cd /var/vcap/packages/postgresql_9.3/bin
./pg_restore -U vcap -d atc -v concourse-schema.sql
sudo su - tempest-web -s /bin/bash -c 'psql tempest_production'
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'uaa_configs';
SELECT id, hostname
FROM uaa_configs;
UPDATE uaa_configs

Keybase proof

I hereby claim:

  • I am zmb3 on github.
  • I am zmb3 (https://keybase.io/zmb3) on keybase.
  • I have a public key whose fingerprint is C772 B1DC 28D0 130B D2BB 97EC C2A6 C64B 5FE5 4A48

To claim this, I am signing this object:

@zmb3
zmb3 / crash.ii
Last active December 31, 2015 13:52
Linaro GCC 4.9 Internal Compiler Error
This file has been truncated, but you can view the full file.
# 1 "src/crash.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/opt/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "src/crash.cpp"
# 1 "/opt/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.3/array" 1 3
# 32 "/opt/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.3/array" 3
# 33 "/opt/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.3/array" 3