<commit_before>#!/usr/bin/env bash
set -o xtrace
set -o verbose
set -o errexit
#set -o nounset

user='whoami'
#guest=$1
#guest_user=$2
guest=
guest_user=
image=

### add check if variables are present ###

#if [ "$guest_user" = "" ]; then
#	echo "User name (hit enter to use '$user')?"
#	read guest_user
#fi
#
#if [ "$guest_user" = "" ]; then
#	guest_user=$user
#fi

# (on GUEST)
ssh -T $guest_user@$guest '
sudo dd if=/dev/zero of=/mytempfile
sudo rm -rf /mytempfile
sudo shutdown -h now
'

# (on HOST)
sudo bash <<EOF
mv /vmdata/storage/${image}.img /vmdata/storage/${image}.img.backup
qemu-img convert -O qcow2 /vmdata/storage/${image}.img.backup /vmdata/storage/${image}.img
EOF<commit_msg>pass guest, image and guest user as script arguments<commit_after>#!/usr/bin/env bash
set -o xtrace
set -o verbose
set -o errexit
#set -o nounset

user=`whoami`
guest=$1
image=$2
guest_user=$3

### add check if variables are present ###

if [ "$guest_user" = "" ]; then
	echo "User name (hit enter to use '$user')?"
	read guest_user
fi

if [ "$guest_user" = "" ]; then
	guest_user=$user
fi

### (on GUEST) ###
ssh -T $guest_user@$guest '
sudo dd if=/dev/zero of=/mytempfile
sudo rm -rf /mytempfile
sudo shutdown -h now
'

### (on HOST) ###
sudo bash <<EOF
mv /vmdata/storage/${image}.img /vmdata/storage/${image}.img.backup
qemu-img convert -O qcow2 /vmdata/storage/${image}.img.backup /vmdata/storage/${image}.img
virsh start --domain $image
EOF

{'fraction_non_alphanumeric': 0.17002081887578072, 'fraction_numerical': 0.004857737682165163, 'mean_word_length': 4.113475177304965, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '955923', 'n_tokens_mistral': 577, 'n_tokens_neox': 571, 'n_words': 163}