Skip to content

Instantly share code, notes, and snippets.

@c-goes
c-goes / hyper-v-ubuntu.md
Last active February 18, 2021 14:22
Hyper-V: Install Ubuntu 19.10 including clipboard integration via xrdp
curl -O https://raw.githubusercontent.com/microsoft/linux-vm-tools/master/ubuntu/18.04/install.sh
chmod +x install.sh
sudo ./install.sh
reboot
sudo ./install.sh
shutdown -h now

Open PowerShell with Admin privileges

@c-goes
c-goes / ula.py
Last active January 3, 2020 20:56
IPv6 ULA generator
import string
import random
h = string.hexdigits[:16]
def c(l):
return ''.join(random.choice(h) for _ in range(l))
print(f"fd{c(2)}:{c(4)}:{c(4)}::/48")
print(f"fd{c(2)}:{c(4)}:{c(4)}:{c(4)}::/64")
@c-goes
c-goes / gist:dd91ee17adcc5dc64c52b57e97dd1370
Created September 16, 2020 15:10
ZFS ext4 volume (zvol) and move LXD container to new ext4 storage pool
zfs create -s -V 100G rpool/lxd_ext4
mkfs.ext4 /dev/zvol/rpool/lxd_ext4
mount /dev/zvol/rpool/lxd_ext4 /mnt
lxc storage create ext4 dir source=/mnt/lxd
lxc stop c1
lxc move c1 c1temp -s ext4
lxc move c1temp c1
lxc start c1
@c-goes
c-goes / Dockerfile
Created April 30, 2021 14:03
Debian Bullseye container in container build
FROM docker.io/debian:bullseye
RUN apt-get update && apt-get -y install ca-certificates buildah
WORKDIR /container
RUN buildah bud --isolation=chroot --storage-driver=vfs -t localhost/test .
@c-goes
c-goes / clean.sh
Last active May 12, 2021 20:32
zsysctl cleanup script -- release space on bpool on Ubuntu 20.04 root on zfs install
#!/usr/bin/env bash
set -euxo pipefail
# use at your own risk
zfs list -r -t snapshot -o name,used,referenced,creation bpool/BOOT | python -c "import sys;print('\n'.join([y[0].split('autozsys_')[1] for y in [x.split() for x in sys.stdin.readlines()] if y[0] != 'NAME']))" | xargs -i"{}" -n1 sudo zsysctl state remove {} --system
sudo zsysctl service gc --all -vv