Skip to content

Instantly share code, notes, and snippets.

View mato's full-sized avatar

Martin Lucina mato

View GitHub Profile
@mato
mato / build.sh
Created February 3, 2024 12:47
Companion script to my FOSDEM 2024 presentation
#!/bin/sh
#
# This script is a companion to my FOSDEM 2024 presentation,
# "Lift and shift: Modernising a legacy LAMP application with systemd-nspawn".
#
# Author: Martin Lucina <martin@lucina.net>
# License: Public domain.
#
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: This needs to run as root." 1>&2
@mato
mato / solo5-config.sh
Last active December 10, 2020 15:02
example of what solo5-config could look like
#!/bin/sh
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file
#
# This file is part of Solo5, a sandboxed execution environment.
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear
# in all copies.
#
@mato
mato / gist:69e11d2078a7924be5e9ad5d3a628452
Created November 5, 2019 14:50
ip bridge support w/ u-root
[ 0.758655] Run /init as init process
2019/11/05 14:49:25 Welcome to u-root!
_
_ _ _ __ ___ ___ | |_
| | | |____| '__/ _ \ / _ \| __|
| |_| |____| | | (_) | (_) | |_
\__,_| |_| \___/ \___/ \__|
2019/11/05 14:49:25 Executing Command: /bbin/date
Tue Nov 5 14:49:25 GMT 2019
@mato
mato / .merlin
Last active March 11, 2019 09:53
MirageOS Unikernel with persistence and TCP, with minimal dependencies
PKG lwt mirage mirage-types mirage-types-lwt functoria-runtime tcpip yojson cstruct
S .
B _build
@mato
mato / gist:96bfaf3a99a824024c0f27e76d99bc63
Created April 5, 2018 09:51
a64-olinuxino v4.16.0 full dmesg
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 4.16.0-00004-g38ce33513343 (mato@nodbug) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #2 SMP PREEMPT Thu Apr 5 11:34:46 CEST 201
8
[ 0.000000] Machine model: Olimex A64-Olinuxino
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 16 MiB at 0x000000007f000000
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x000000007fffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0x7efe2e80-0x7efe497f]
@mato
mato / README
Last active March 15, 2018 14:23
a64-olinuxino boot0.bin
Source: https://www.olimex.com/wiki/images/1/1b/A64olinuxino_ubuntu_16.04.3_20171110.torrent
Extracted with: dd if=a64olinuxino_ubuntu_16.04.3_20171110.img of=boot0.bin bs=8k skip=1 count=4
@mato
mato / xx
Created February 21, 2017 16:35
gmake depend
opam pin add --no-action --yes mirage-unikernel-https-virtio .
[NOTE] Package mirage-unikernel-https-virtio is already path-pinned to
/usr/home/mato/mirage3-skeleton/applications/static_website_tls.
This will erase any previous custom definition.
Proceed ? [Y/n] y
[mirage-unikernel-https-virtio] /usr/home/mato/mirage3-skeleton/applications/static_website_tls/ synchronized
[mirage-unikernel-https-virtio] Installing new package description from
/usr/home/mato/mirage3-skeleton/applications/static_website_tls
@mato
mato / issue_71.c
Created March 31, 2016 14:13
rumprun #71 test program
#include <err.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sched.h>
#include <string.h>
int main(int argc, char *argv[])
{
time_t start;
$ rumprun-bake hw_virtio hello.bin hello args
[...]
$ cat > hello.json
{
"rc": [
{ "bin": "args", "argv": [ "first", "1", "2", "3", "4" ] },
{ "bin": "args", "argv": [ "first again", "1", "2", "3", "4" ] },
{ "bin": "hello", "argv": [ "hello" ] },
{ "bin": "args", "argv": [ "and again", "1", "2", "3", "4" ] },
{ "bin": "args", "argv": [ "again", "1", "2", "3", "4" ] }
#!/bin/sh
running=$(docker ps -q | wc -l)
all=$(docker ps -a -q | wc -l)
images=$(docker images | awk '/^<none>/ { print $3 }' | wc -l)
echo "Found ${running} running containers."
echo "Found ${all} total containers."
echo "Found ${images} untagged images."
cat <<EOM
This will stop *all* Docker containers, delete them and then delete