The code below (data encoded in Go) and then decoded in Rust. works fine.
extern crate rmp_serde as rmps;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#!/bin/sh | |
# this script is called as `volstat.sh <path/to/subvol>` | |
set -e | |
vol=$1 | |
id=$(btrfs subvol show $vol | grep 'Subvolume ID:'| cut -f 4) | |
output=$(btrfs qgroup show --raw -r $vol| grep "^0/$id") | |
size=$(echo $output | cut -d ' ' -f 4) |
#!env bash | |
socket="/tmp/virtiofs.sock" | |
# override this as well if u wanna change | |
# the vm entry point | |
init=/sbin/init | |
# pass to extracted tarball | |
dir=$1 |
set -e | |
# you need to run `docker save <image> -o <file>.tar | |
# then run this script like `extrat-image.sh <file>.tar` | |
# it will create a directoyr `<file>.tar-root` which containers | |
# all files from the image extracted | |
input=$1 | |
if [ ! -f "${input}" ]; then | |
echo "file does not exist" |
use std::collections::HashMap; | |
struct Module; | |
struct Data { | |
modules: HashMap<String, Module>, | |
} | |
impl Data { | |
fn module<S: AsRef<str>>(&mut self, name: S) -> &mut Module { | |
if let Some(m) = self.modules.get_mut(name.as_ref()) { |
#!env sh | |
set -e | |
sudo systemctl stop bluetooth | |
sudo modprobe -r btusb btrtl btbcm btintel | |
sudo modprobe btusb | |
sudo systemctl start bluetooth | |
pulseaudio -k | |
sleep 1s | |
bluetoothctl power on |
#!env sh | |
# this file depends on rankmirrors package | |
tmp=$(mktemp) | |
trap "rm -f ${tmp}" EXIT | |
curl "https://www.archlinux.org/mirrorlist/?country=BE&country=FR&country=DE&country=IL&protocol=http&protocol=https&ip_version=4&use_mirror_status=on" | sed "s/#Server/Server/g" > $tmp | |
rankmirrors ${tmp} | sudo tee /etc/pacman.d/mirrorlist |
struct Cache {} | |
impl Cache { | |
fn new() -> Cache { | |
Cache {} | |
} | |
fn get(&mut self, key: &u32) -> Option<&str> { | |
None | |
} |
#SET TO DESTINATION IP | |
DEST_IP='172.17.0.1' | |
#CHANGE IF NECESSARY (the dest ip should be reachable from eth0) | |
DEV=eth0 | |
dmesg -n 7 | |
modprobe configfs |
#!/bin/bash | |
if [ $# != 2 ] ; then | |
echo "usage $0 PATH_TO_BINARY TARGET_FOLDER" | |
exit 1 | |
fi | |
PATH_TO_BINARY="$1" | |
TARGET_FOLDER="$2" |