Skip to content

Instantly share code, notes, and snippets.

@OutOfThisPlanet
Last active December 27, 2023 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OutOfThisPlanet/6718d238490d012699b3bebd4e58dd17 to your computer and use it in GitHub Desktop.
Save OutOfThisPlanet/6718d238490d012699b3bebd4e58dd17 to your computer and use it in GitHub Desktop.
Alert when Deeper Network BSC Bridge resets
Function BSCBridgeTotal
{
param()
(Invoke-WebRequest -UseBasicParsing -Uri "https://api-device.deeper.network/bridge/bsc/todayTotal" |
Select-Object -ExpandProperty Content | ConvertFrom-Json).data
}
$voice = New-Object -ComObject Sapi.spvoice
$voice.rate = 0
while ($voice.rate -eq 0)
{
while ((BSCBridgeTotal | Tee-Object -Variable BSCBridgeTotal) -ge 599000 -and ($BSCBridgeTotal))
{
CLS
$Date = (Get-Date | Out-String).TrimEnd()
Write-Output "$Date - Waiting for BSC Deeper Network Bridge to reset - $BSCBridgeTotal DPR consumed on the bridge"
if (($Date -like "*0:00") -or ($Date -like "*0:01"))
{
$voice.speak("$Date - Waiting for BSC Deeper Network Bridge to reset - $BSCBridgeTotal DPR consumed on the bridge") | Out-Null
}
Start-Sleep 1
}
if (!($BSCBridgeTotal))
{
$Date = Get-Date
$voice.speak("Attention! BSC Deeper Network Bridge has shit the bed! - $Date") | Out-Null
}
elseif (($BSCBridgeTotal -ge 0))
{
$voice.speak("BSC Deeper Network Bridge Reset - $($BSCBridgeTotal) DPR used") | Out-Null
}
else
{
$voice.speak("DERP DERP DERP DERP DERP DERP DERP DERP DERP!") | Out-Null
}
}
@OutOfThisPlanet
Copy link
Author

OutOfThisPlanet commented Dec 1, 2023

image

image

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment