This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Original code by Mike Smith -- https://stackoverflow.com/a/67510672/33244 | |
| # Load your jobs here... Note that they periodically report their status. | |
| Start-Job -Name "LoopA" -ScriptBlock { $i = 0; 1..5 | ForEach-Object { Start-Sleep -Seconds 1; $i++; "$i of 5 complete" }; Start-Sleep -Seconds 1; } | |
| Start-Job -Name "LoopB" -ScriptBlock { $i = 0; 1..5 | ForEach-Object { Start-Sleep -Seconds 2; $i++; "$i of 5 complete" }; Start-Sleep -Seconds 1; } | |
| Start-Job -Name "LoopC" -ScriptBlock { $i = 0; 1..5 | ForEach-Object { Start-Sleep -Seconds 3; $i++; "$i of 5 complete" }; Start-Sleep -Seconds 1; } | |
| # Loop and report status | |
| do { | |
| # Interval between updates; change for your application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Install Windows OpenSSH server | |
| # https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse | |
| # | |
| Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 # NOP in Server 2025 (already installed) | |
| Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 # NOP in Server 2025 (already installed) | |
| Start-Service sshd | |
| Set-Service -Name sshd -StartupType 'Automatic' | |
| # Confirm the Firewall rule is configured. It should be created automatically by setup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Original code by travis.vitek at https://bit.ly/3WPIu4h | |
| import argparse | |
| import json | |
| import os | |
| import socket | |
| import sys | |
| import time | |
| from datetime import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Write-HexDump { | |
| <# | |
| .SYNOPSIS | |
| Displays a hex dump of a file's contents. | |
| .PARAMETER FilePath | |
| Path to the file to display as a hex dump. | |
| .PARAMETER ByteCount | |
| Number of bytes to read and display. Default is 256. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-SystemPath { | |
| $keyName = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' | |
| $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($keyName, 'ReadOnly') | |
| try { | |
| return $key.GetValue('Path', '', 'DoNotExpandEnvironmentNames') -split [IO.Path]::PathSeparator | |
| } finally { | |
| if ($null -ne $key) { | |
| $key.Dispose() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # setup-router.sh | |
| # | |
| # Configure a simple router based on Debian 12/Bookworm. | |
| # | |
| # Base image: | |
| # https://cloud.debian.org/images/cloud/bookworm/20240901-1857/debian-12-genericcloud-amd64-20240901-1857.qcow2 | |
| # | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CmdletBinding(SupportsShouldProcess)] | |
| Param() | |
| # | |
| # Settings | |
| # | |
| # Services to test | |
| $urls = 'https://1.1.1.1/cdn-cgi/trace', # 13,86 | |
| 'https://myip.dnsomatic.com/', # 17,45 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Demo for issue: Kopia not running actions when snapshot source is a single file. | |
| # | |
| # Tested with | |
| # Kopia 0.13.0 | |
| # Windows Server 2022 | |
| # | |
| # Demo settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-FolderUsage([String]$Folder) { | |
| [PSCustomObject]@{ | |
| FullName=Join-Path -Path $Folder -ChildPath '*'; | |
| SizeGb=[int]((Get-ChildItem -File $Folder | Measure-Object -Property Length -Sum).Sum / 1GB) | |
| } | Write-Output | |
| Get-ChildItem -Directory -Path $Folder | | |
| ForEach-Object { | |
| [PSCustomObject]@{ | |
| FullName=$_.FullName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Fable.Plugins | |
| #r "../../build/fable/bin/Fable.exe" | |
| open Fable.AST | |
| open Fable.AST.Fable | |
| open Fable.FSharp2Fable | |
| type RandomPlugin() = | |
| interface IReplacePlugin with |