Skip to content

Instantly share code, notes, and snippets.

karlgluck /
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:

learn Unreal Engine 5 (UE5 - free pro software, this is what the industry uses now
get it from the Epic Games Launcher
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
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
# 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
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
Set-Variable -Name "SCHED_S_TASK_HAS_NOT_RUN" -Value 0x00041303 -Option Constant
karlgluck / RunAtLoginExample.ps1
Created May 15, 2022 19:02
How to register a script block to run with elevated privileges when the current user logs in
$JobName = "RunAtLoginExample"
$Enabled = $True # set to $False and run to remove the job
# Output: %LOCALAPPDATA%\Microsoft\Windows\PowerShell\ScheduledJobs\$JobName
$accountId = ((Get-WMIObject -class Win32_ComputerSystem | Select-Object -ExpandProperty username))
$Trigger = New-JobTrigger -AtLogOn
$JobOptions = New-ScheduledJobOption -StartIfOnBattery -RunElevated
karlgluck / CreatePathIfDoesntExistExample.ps1
Created May 14, 2022 19:57
One-liner to create a path if it doesn't exist
if (-not (Test-Path $Path)) { New-Item $Path -ItemType Directory | Out-Null }
karlgluck / ExtractFileFromZipExample.ps1
Created May 14, 2022 17:46
How to extract a single file from a ZIP archive using Powershell
$ZipFilePath = ""
$FileNameInZip = ""
Add-Type -AssemblyName System.IO.Compression.FileSystem
$Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipFilePath)
$Zip.Entries |
Where-Object { $_.Name -eq $FileNameInZip } |
ForEach-Object {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $_.Name, $true)
karlgluck / DownloadFromPrivateGitHubRepoExample.ps1
Created May 14, 2022 17:32
One-liner for downloading from a private GitHub repository
# Fill these in with your own values
$Username = "your_username"
$Branch = "main"
$PathToFile = ""
# Go to [] and add a Personal Access Token with two scopes: "repo" and "read:org"
Invoke-WebRequest -Method Get -Uri "$Username/$Repository/$Branch/$PathToFile" -Headers @{Authorization="token $GitHubAuthToken"; 'Cache-Control'='no-cache'} | ForEach-Object { $_.Content } | Write-Host
karlgluck / RoombaVictory.ps1
Created September 18, 2019 00:55
Play the Roomba's victory jingle using the Powershell beep. Because why not?
Start-Sleep -Milliseconds 200
karlgluck / PerfectPixelCamera.cs
Created September 13, 2018 22:35
Main file from the Perfect Pixel Camera asset on the Unity asset store, licensed with MIT
// Copyright 2018 Karl Gluck
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in