Skip to content

Instantly share code, notes, and snippets.

View tomesparon's full-sized avatar

Tom Esparon tomesparon

View GitHub Profile
@tomesparon
tomesparon / move_to_folder.bat
Created October 8, 2025 11:44
A batch script to take in .raw files and put in folders with Initial and Surname - For CT raw - can be modified for other files with a name convention similar
@echo off
setlocal EnableExtensions EnableDelayedExpansion
cls
@pushd %~dp0
REM HOW TO USE: Either drag and drop the folder eg CRAFT onto bat and let it run, or
REM open in powershell / cmd and add the full path as first arg
REM Optional argument: source folder. Defaults to current folder.
set "SRC=%~1"
@tomesparon
tomesparon / usbcopy
Created October 8, 2025 15:31
robocopy off of
# Define the volume label of the USB drive
$targetLabel = "cyc"
$destinationRoot = "\\FSERVER\Archive\test" # Replace with your actual network share path
# Change filter to *.dcm if these are DICOM files
$fileFilter = "*.raw"
# Find the USB volume by label (DriveType 2 = Removable)
$usbDrive = Get-CimInstance Win32_Volume |
Where-Object { $_.Label -eq $targetLabel -and $_.DriveType -eq 2 } |
@tomesparon
tomesparon / vmbackup.sh
Created March 11, 2026 16:31
KVM backup script - #libvirt #virtnbdbackup
#!/usr/bin/env bash
# Tom Esparon - 2026
# KVM backup operations cycle for active/running kvm machines(only).
#
# Backup captures:-
# File-backed disks: virtnbdbackup (stream) with lz4 compression
# LVM-backed disks (/dev/...): live lvm based snapshot -> pv -> xz -> file (once per month)
# VM XML config : saved with xmldump for LVM-backed VMs, virtnbdbackup handles file-backed VMs
#
# The first backup of every vm on every new month is forced to be full size,