This file contains hidden or 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
| #requires -RunAsAdministrator | |
| $registryPath = 'HKLM:\SOFTWARE\Policies\BraveSoftware\Brave' | |
| if (-not (Test-Path -Path $registryPath)) { | |
| New-Item -Path $registryPath -Force | |
| } | |
| $set = @' | |
| 1,BraveRewardsDisabled |
This file contains hidden or 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
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Diagnostics; | |
| using System.Management.Automation; | |
| using System.Threading.Tasks; | |
| public readonly struct MemoryCounterSample(float invocationBytes, float processBytes) | |
| { | |
| private const long Mb = 1_048_576; | |
| public readonly DateTime TimeStamp = DateTime.Now; |
This file contains hidden or 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
| using System; | |
| using System.IO; | |
| using System.Management.Automation; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| [Cmdlet(VerbsDiagnostic.Test, "Encrypt")] | |
| public sealed class EncryptAes : PSCmdlet | |
| { | |
| [Parameter(Mandatory = true, Position = 0)] |
This file contains hidden or 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
| // Source - https://stackoverflow.com/a/79911456 | |
| // Posted by Santiago Squarzon, modified by community. See post 'Timeline' for change history | |
| // Retrieved 2026-03-20, License - CC BY-SA 4.0 | |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Management.Automation; | |
| using System.Management.Automation.Provider; |
This file contains hidden or 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
| # Requires module ClassExplorer | |
| $method = [System.Management.Automation.LanguagePrimitives] | fime -f FigureConversion -ParameterCount 3 | |
| # Rank: NullToValue | |
| $flag = $null | |
| $converter = $method.Invoke($null, @($null, [int], $flag)) | |
| $converter.Invoke($null, [int], $true, $null, [cultureinfo]::InvariantCulture, $null) | |
| # Rank: NullToRef | |
| $flag = $null |
This file contains hidden or 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
| using System; | |
| using System.ComponentModel; | |
| using System.Runtime.InteropServices; | |
| public static class Native | |
| { | |
| private static EXECUTION_STATE? s_prevState; | |
| private const uint INPUT_KEYBOARD = 1; | |
| private const uint KEYEVENTF_KEYUP = 0x0002; |
This file contains hidden or 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
| ## Ignore Visual Studio temporary files, build results, and | |
| ## files generated by popular Visual Studio add-ons. | |
| benchmarks/ | |
| BenchmarkDotNet.Artifacts/ | |
| tools/dotnet | |
| # User-specific files | |
| *.suo | |
| *.user |
This file contains hidden or 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 Invoke-Retry { | |
| [Alias('retry')] | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory)] | |
| [scriptblock] $Scriptblock, | |
| [Parameter()] | |
| [scriptblock] $RetryHandler, |
This file contains hidden or 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-EffectiveAccess { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
| [ValidatePattern('(?:(CN=([^,]*)),)?(?:((?:(?:CN|OU)=[^,]+,?)+),)?((?:DC=[^,]+,?)+)$')] | |
| [alias('DistinguishedName')] | |
| [string] $Identity, | |
| [parameter()] | |
| [alias('Domain')] |
This file contains hidden or 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
| using System; | |
| using System.Collections; | |
| using System.Linq; | |
| using System.Management.Automation; | |
| using System.Reflection; | |
| using System.Text; | |
| using Microsoft.PowerShell.Commands; | |
| using PowerShell ps = PowerShell.Create().AddCommand("Get-ComputerInfo"); | |
| ComputerInfo info = ps.Invoke<ComputerInfo>()[0]; |
NewerOlder