Skip to content

Instantly share code, notes, and snippets.

@simg
simg / unit_auto_replace.lua
Created January 23, 2025 16:15
Beyond All Reason - Unit Auto Replacer widget
---@diagnostic disable: duplicate-set-field
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: unit_auto_replace.lua
-- brief: Automatically replaces units and replicates their orders if they are destroyed
-- author: Simon Gardner
--
-- Copyright (C) 2023.
@L-e-x-o-n
L-e-x-o-n / cmd_improved_area_reclaim.lua
Last active May 4, 2025 09:23
Easier and smarter area unit reclaim orders, priority system by team and unitdef
function widget:GetInfo()
return {
name = "Improved unit area reclaim",
desc = "Easier and smarter area unit reclaim orders, priority system by team and unitdef",
author = "Lexon",
date = "17.07.2022",
version = 1.1,
license = "GNU GPL, v2 or later",
layer = 10,
enabled = true -- loaded by default?
@likamrat
likamrat / WinGet_WinSrv.ps1
Created February 13, 2023 00:41
Installing Winget om Windows Server 2019/2022
Write-Information "This script needs be run on Windows Server 2019 or 2022"
If ($PSVersionTable.PSVersion.Major -ge 7){ Write-Error "This script needs be run by version of PowerShell prior to 7.0" }
# Define environment variables
$downloadDir = "C:\WinGet"
$gitRepo = "microsoft/winget-cli"
$msiFilenamePattern = "*.msixbundle"
$licenseFilenamePattern = "*.xml"
$releasesUri = "https://api.github.com/repos/$gitRepo/releases/latest"
@PanosGreg
PanosGreg / Encrypt-Decrypt-WithDotNet.ps1
Last active April 1, 2024 17:13
Encryption & Decryption using native .NET classes
## Encryption & Decryption using native .NET functions
## This is Symetrical encryption. Which means the same key is used to both encrypt and decrypt.
## The encryption method is based on AES 256bit.
## The major difference between this option and the ConvertFrom/To-SecureString functions
## is that this way produces much smaller encrypted files.
## I have not compared the 2 options in regards to performance though, as-in which one is faster.
@gioxx
gioxx / O365LicenseFriendlyName.txt
Created March 7, 2022 10:38
Una lista di mappatura tra licenze Office 365 (SkuPartNumber via PowerShell) e nome più amichevole (la base è stata curata da https://o365reports.com/2021/11/23/office-365-license-reporting-and-management-using-powershell, in seguito modificata da me) - https://gioxx.org
AAD_BASIC= Azure Active Directory Basic
AAD_PREMIUM= Azure Active Directory Premium
AAD_PREMIUM_P1= Azure Active Directory Premium P1
AAD_PREMIUM_P2= Azure Active Directory Premium P2
ADALLOM_O365= Office 365 Advanced Security Management
ADALLOM_STANDALONE= Microsoft Cloud App Security
ADALLOM_S_O365= POWER BI STANDALONE
ADALLOM_S_STANDALONE= Microsoft Cloud App Security
ATA= Azure Advanced Threat Protection for Users
ATP_ENTERPRISE= Exchange Online Advanced Threat Protection
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active April 28, 2025 21:31
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
function PNValidate {
$Results = [PSCustomObject]@{
Spooler = $null
PatchInstalled = $false
RestrictDriverInstallationToAdministrators = $null
NoWarningNoElevationOnInstall = $null
UpdatePromptSettings = $null
Exploitable = $true
Explanation = $null
}
@maxkoshevoi
maxkoshevoi / download-latest-release.ps1
Created April 9, 2021 18:05
Download latest GitHub release via Powershell
$repoName = "PowerShell/PowerShell"
$assetPattern = "*-win-x64.msi"
$extractDirectory = "C:\Users\Public\Downloads"
$releasesUri = "https://api.github.com/repos/$repoName/releases/latest"
$asset = (Invoke-WebRequest $releasesUri | ConvertFrom-Json).assets | Where-Object name -like $assetPattern
$downloadUri = $asset.browser_download_url
$extractPath = [System.IO.Path]::Combine($extractDirectory, $asset.name)
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@jonesandy
jonesandy / XUnitAsserts.cs
Last active May 6, 2025 03:55
A cheat sheet of Asserts for xUnit.net in C#
/*
STRINGS
*/
Assert.Equal(expectedString, actualString);
Assert.StartsWith(expectedString, stringToCheck);
Assert.EndsWith(expectedString, stringToCheck);
// Some can also take optional params
Assert.Equal(expectedString, actualString, ignoreCase: true);
Assert.StartsWith(expectedString, stringToCheck, StringComparison.OrdinalIgnoreCase);