Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
import subprocess
import os
import os.path
import logging
import shutil
import shlex
@bboozzoo
bboozzoo / sc
Last active January 26, 2021 10:03
minimal snap client
#!/bin/bash
# naive snap replacement
set -ex
SNAPD_SOCKET=/run/snapd.socket
CURL="${CURL:-curl}"
CURL_CMD="${CURL} --unix-socket $SNAPD_SOCKET -D- -v"
#!/bin/bash
set -eu -o pipefail
if [ -n "${V:-}" ]; then
set -x
fi
CGROUP_BASE_MOUNT=/sys/fs/cgroup
CGROUPV1_MEMORY_MOUNT=/sys/fs/cgroup/memory
@bboozzoo
bboozzoo / a.c
Created December 11, 2020 07:20
// gcc -lapparmor
#include <sys/apparmor.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *label, *mode = NULL;
if (aa_getcon(&label, &mode) == -1) {
perror("aa_getcon");
#!/usr/bin/env python3
import argparse
import subprocess
import os
import os.path
import logging
import shutil
import shlex
#!/bin/bash
set -e
if [[ -n "$D" ]]; then
set -x
fi
##HELP: Usage: repack-kernel <command> <opts>
##HELP:
@bboozzoo
bboozzoo / cloud-images.md
Last active March 19, 2024 13:10
Short guide to preparing VMs for local development

Trivial guide for setting up cloud images (incl. Ubuntu Core) for local development in VM.

It's assumed that the images are configured to run cloud-init.

Local cloud-init config

Example cloud configuration file:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/sh
set -x
set -e
if [ "$#" -lt 3 ]; then
echo "usage: $0 <source-img> <dest-img> <uci-config>"
exit 1
fi
#cloud-config
password: fedora
chpasswd: { expire: False }
ssh_pwauth: True
datasource_list: [ NoCloud, None ]
packages:
- kernel-modules
- nc
- strace
- xdelta