This file contains 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
$global:queue = [System.Collections.Queue]::Synchronized( (New-Object System.Collections.Queue) ) | |
foreach($item in $jobInput) | |
{ | |
$global:queue.Enqueue($item) | |
} | |
$global:resultCode = [hashtable]::Synchronized(@{}) | |
function RunJobFromQueue { |
This file contains 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-ScreenShot([Int]$TopRightX,[Int]$TopRightY,[Int]$BottomLeftX,[Int]$BottomLeftY, [string]$Name) { | |
$bounds = [Drawing.Rectangle]::FromLTRB($TopRightX,$TopRightY, $BottomLeftX,$BottomLeftY) | |
$bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height | |
$graphics = [Drawing.Graphics]::FromImage($bmp) | |
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size) | |
$screenCapturePathBase = "$pwd\$name.png" | |
if (Test-Path $screenCapturePathBase) { | |
Remove-Item $screenCapturePathBase | |
} |
This file contains 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
As requested on reddit, here is some information about how i made a "realtime" dashboard. | |
Flow | |
=== | |
1. a task grab data with a scheduled job. It saves the data in json in two places: one static folder, which overwrite existing data, and in a temporary folder, to be a new "event". | |
2. a websocket deamon (websocketd) run a powershell script listening to changes in the temporary folder. When a change happens, the new data is read and sent thru the websocket | |
3. the frontend update the data with what came thru the websocket. If the browser does not support websocket, it will instead pull the data from time to time | |
Grabbing Data and saving as JSON |