From e09f8402d5ce8e1e6ebc9e55afed4de6cb3c26d8 Mon Sep 17 00:00:00 2001 From: Zack Meier Date: Sat, 16 May 2026 20:35:37 -0500 Subject: [PATCH] things --- docker-compose_rustdesk.yml | 28 ++++++++++ truenas snapshot report.ps1 | 68 +++++++++++++++++++++++ yt-dlp/Download-RegulationPatreon_NEW.ps1 | 5 +- 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 docker-compose_rustdesk.yml create mode 100644 truenas snapshot report.ps1 diff --git a/docker-compose_rustdesk.yml b/docker-compose_rustdesk.yml new file mode 100644 index 0000000..8162b7b --- /dev/null +++ b/docker-compose_rustdesk.yml @@ -0,0 +1,28 @@ +version: "3.8" + +services: + hbbs: + image: rustdesk/rustdesk-server:1.1.11 + container_name: rustdesk-hbbs + command: hbbs -r ${RUSTDESK_DOMAIN}:21117 + volumes: + - ./data/hbbs:/root + ports: + - "21115:21115" + - "21116:21116" + - "21116:21116/udp" + - "21118:21118" + restart: unless-stopped + + hbbr: + image: rustdesk/rustdesk-server:1.1.11 + container_name: rustdesk-hbbr + command: hbbr + volumes: + - ./data/hbbr:/root + ports: + - "21117:21117" + - "21119:21119" + depends_on: + - hbbs + restart: unless-stopped \ No newline at end of file diff --git a/truenas snapshot report.ps1 b/truenas snapshot report.ps1 new file mode 100644 index 0000000..e4457e7 --- /dev/null +++ b/truenas snapshot report.ps1 @@ -0,0 +1,68 @@ +# Set up your TrueNAS server details and API Key +$TrueNASSource = "https://truenas3.kwyjibo.info" +$APIKeySource = "1-JLgbBRp1c0xRlAi5237SFeb7LZnLT23k4K8u95ewqgvTDO8jauv5r6s2MIPH7GmW" # Replace with your actual API key + +# Construct the full API URL +$TrueNASSourceUrl = "$TrueNASSource$Endpoint" + +# Set up the headers with the API Key for authentication +$headers = @{ + "Authorization" = "Bearer $APIKeySource" + "Content-Type" = "application/json" +} + +$Endpoint = "/api/v2.0/zfs/snapshot" +$TrueNASSourceUrl = "$TrueNASSource$Endpoint" +$SnapshotSplat = @{ + Uri = $TrueNASSourceUrl + Headers = $headers + Method = "Get" + SkipCertificateCheck = $true +} +$Snapshots = Invoke-RestMethod @SnapshotSplat + + +# report on snapshot sizes +$Report = +$Snapshots | +ForEach-Object { + [PSCustomObject]@{ + Dataset = $_.dataset + + UsedGB = [math]::Round( + [int64]$_.properties.logicalreferenced.rawvalue / 1GB, 2 + ) + + Creation = [DateTimeOffset]::FromUnixTimeSeconds( + [int64]$_.properties.creation.rawvalue + ).LocalDateTime + } +} | +Group-Object Dataset | ForEach-Object { + $snaps = $_.Group | Sort-Object Creation + $newest = $snaps[-1] + + [PSCustomObject]@{ + Dataset = $_.Name + + NewestSnapshotDate = $newest.Creation + NewestSnapshotGB = $newest.UsedGB + + SmallestSnapshotGB = ($snaps | Measure-Object UsedGB -Minimum).Minimum + LargestSnapshotGB = ($snaps | Measure-Object UsedGB -Maximum).Maximum + + SnapshotCount = $snaps.Count + SnapshotOverhead = ($snaps | Measure-Object UsedGB -Maximum).Maximum - $newest.UsedGB + } +} + +$Report | Where-Object { $_.Dataset -NotLike "*boot*" -and $_.Dataset -notlike "*apps*" } | Format-Table -AutoSize + +$Report | Where-Object { $_.Dataset -Like "*Delta*" } | Measure-Object -Property SnapshotOverhead -Sum + +$DatasetRoots = @($Report | ForEach-Object { $_.Dataset.split('/')[0] } | Where-Object { $_ -notlike "*boot*" -and $_ -notlike "*nvme*" -and $_ -notlike "*Sidewinder*" } | Select-Object -Unique ) + +$DatasetRoots | ForEach-Object { + $_; + $Report | Where-Object { $_.Dataset -like "*$_*" } + } \ No newline at end of file diff --git a/yt-dlp/Download-RegulationPatreon_NEW.ps1 b/yt-dlp/Download-RegulationPatreon_NEW.ps1 index 34d32df..2d20c4d 100644 --- a/yt-dlp/Download-RegulationPatreon_NEW.ps1 +++ b/yt-dlp/Download-RegulationPatreon_NEW.ps1 @@ -51,10 +51,11 @@ function Download-YTDLP { } # 1. Execute yt-dlp using the call operator (&) and passing the arguments array (@) - & $ytDlpPath $arguments + $output = & $ytDlpPath @arguments 2>&1 + $exitCode = $LASTEXITCODE # 2. CRITICAL: Check the Exit Code immediately after execution - if ($LASTEXITCODE -ne 0) { + if ($exitCode -ne 0) { # If the exit code is not 0, we throw a terminating exception. # This exception will be caught by your external try/catch block! $ErrorMessage = "yt-dlp failed (Exit Code: $($LASTEXITCODE)). Check standard error output for details."