Skip to content

Instantly share code, notes, and snippets.

@s-h-a-d-o-w
s-h-a-d-o-w / offline-check.ps1
Last active January 31, 2026 15:23
Repeatedly checks whether a certain IP is reachable and shows a popup if it's not.
$ip = "..."
Add-Type -AssemblyName System.Windows.Forms
$ping = New-Object System.Net.NetworkInformation.Ping
while ($true) {
$failures = 0
for ($i = 0; $i -lt 15; $i++) {
try {
$result = $ping.Send($ip, 3000) # 3 second timeout
@s-h-a-d-o-w
s-h-a-d-o-w / history.ps1
Created February 10, 2026 16:32
Powershell command history GUI
# Put into $PROFILE, trigger with Ctrl+h
Set-PSReadLineKeyHandler -Chord Ctrl+h -ScriptBlock {
$history = Get-Content (Get-PSReadLineOption).HistorySavePath
[array]::Reverse($history)
$selected = $history | Out-GridView -PassThru
if ($selected) {
[Microsoft.PowerShell.PSConsoleReadLine]::Insert($selected)
}
}