Skip to content

Instantly share code, notes, and snippets.

@MOZGIII
MOZGIII / 1.log
Last active March 31, 2019 07:41
Valgrind runs on cpal crash
==22472== Memcheck, a memory error detector
==22472== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22472== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22472== Command: ./target/debug/examples/crash
==22472==
==22472== Invalid write of size 8
==22472== at 0x4C367E3: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22472== by 0x9684359: memcpy (string3.h:53)
==22472== by 0x9684359: pulse_read (pcm_pulse.c:534)
==22472== by 0x4ECF9F7: ioplug_priv_transfer_areas (pcm_ioplug.c:564)
__GI_raise (@7ffff6ed8dd0..7ffff6ed8ed1:44)
__GI_abort (@7ffff6eda6c0..7ffff6eda8fc:70)
__libc_message (@7ffff6f23620..7ffff6f23907:171)
malloc_printerr (@7ffff6f2a90a..7ffff6f2a978:3)
free_check (@7ffff6f2c3b0..7ffff6f2cc5e:277)
free_check (@7ffff6f2c3b0..7ffff6f2cc5e:241)
__GI___libc_free (@7ffff6f31950..7ffff6f32781:170)
alloc::alloc::dealloc::h0de958ac6166530e (@555555599ad0..555555599b28:20)
_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Alloc$GT$::dealloc::h131e19760b84a430 (@5555555998d0..55555559990f:15)
_$LT$alloc..raw_vec..RawVec$LT$T$C$$u20$A$GT$$GT$::dealloc_buffer::h1489bef342d5e1b4 (@55555557efe0..55555557f094:41)
@MOZGIII
MOZGIII / ip-addr-show.sh
Created April 19, 2018 21:09
Print VM IP addresses with Docker for Mac
docker run -it --rm --privileged --pid=host justincormack/nsenter1 $(which ip) addr show
const readFile = path =>
new Promise<string>((resolve, reject) =>
fs.readFile(path, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data.toString());
}
})
);
@MOZGIII
MOZGIII / docker-compose.yml
Created March 11, 2018 18:39
docker-compose nested values sample
version: '3.5'
x-env: &env-common
COMMON_VALUE: "my-common-value"
x-service: &service-common
network_mode: host
environment:
<<: *env-common
@MOZGIII
MOZGIII / policies.json
Created March 11, 2018 16:39
Terraform S3 backend IAM policies
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "s3",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:DeleteItem",
"dynamodb:GetItem"
@MOZGIII
MOZGIII / run.sh
Created January 2, 2018 01:07
iSCSI backport
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial python-rtslib-fb
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial python-configshell-fb
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial targetcli-fb
@MOZGIII
MOZGIII / per_device_routing_tables.sh
Last active November 24, 2017 03:29
Multiple routing tables (per interface) table with NetworkManager
#!/bin/sh
# Run
# chown root:root per_device_routing_tables.sh
# chmod 700 per_device_routing_tables.sh
#
# or NM will refuse to run the script.
# Then move the script to /etc/NetworkManager/dispatcher.d
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
@MOZGIII
MOZGIII / kubeadm-cgroups-config.md
Last active November 19, 2017 04:30
Kubernetes Pro Tips (Free!)

Here's how to make sure docker and kubelet use same cgroups driver by explicitly configuring both:

Docker:

$ cat /etc/docker/daemon.json
{
    "exec-opts": ["native.cgroupdriver=cgroupfs"]
}
@MOZGIII
MOZGIII / debain-installer-armhf-pxe-boot
Last active October 1, 2017 16:16
Running debian installer via PXE boot (on cubox-i, but may help you on other platforms)
run findfdt
run bootcmd_dhcp