Skip to content

Instantly share code, notes, and snippets.

@karlgluck
karlgluck / WaitForScheduledTaskExample.ps1
Last active May 15, 2022 21:18
Example of how to wait for a scheduled task to finish running
$Trigger = New-JobTrigger -Once -At (get-date).AddSeconds(5)
$JobOptions = New-ScheduledJobOption -StartIfOnBattery -RunElevated
$Job = Register-ScheduledJob -Name "TaskName" -Trigger $Trigger -ScheduledJobOption $JobOptions `
-ScriptBlock {
Sleep 5
}
# From https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-error-and-success-constants?redirectedfrom=MSDN
Set-Variable -Name "SCHED_S_TASK_HAS_NOT_RUN" -Value 0x00041303 -Option Constant
# This will register a new job that removes itself from Get-ScheduledJob when finished
$Trigger = New-JobTrigger -Once -At (Get-Date).AddSeconds(3)
$TaskName = "SelfDestructingJob"
Register-ScheduledJob -Trigger $Trigger -Name $TaskName `
-ScriptBlock ([scriptblock]::Create(@"
("Started job at " + (Get-Date) + ", waiting...") | Out-File -FilePath 'C:\ProofThatItWorks.txt'
Start-Sleep 3
("Finished at " + (Get-Date)) | Out-File -Append -FilePath 'C:\ProofThatItWorks.txt'
Unregister-ScheduledJob -Name '$TaskName' -Force
learn Unreal Engine 5 (UE5 https://www.unrealengine.com) - free pro software, this is what the industry uses now
get it from the Epic Games Launcher https://store.epicgames.com/
do projects alone at first. take time to learn the basics. multiplayer is always more complicated.
buying asset store projects is an unreasonably effective way to learn https://www.unrealengine.com/marketplace
learning projects should be simple enough to finish.
blueprints is a programming language for games used by UE5. Many games are possible using only blueprints code. start by searching for “beginner blueprint tutorials ue5”
find a good place to ask questions, like a Discord community or https://forums.unrealengine.com/
@karlgluck
karlgluck / build_lastpass-cli_win11.md
Last active April 28, 2024 19:41
How to export all LastPass attachments by building lastpass-cli on Windows 11 in 2024

This was harder to do than it should have been.

Install the Windows Subsystem for Linux and get an Ubuntu container running:

PS > wsl --install
PS > wsl --install -d Ubuntu

Run Ubuntu from the Start menu. In the console, become root and install dependencies: