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 Show-BinaryFile { | |
<# | |
.SYNOPSIS | |
Binary file viewer. | |
.DESCRIPTION | |
This function will read and output a HEX and ASCII representation of a | |
binary file, similar to hex editors. | |
.EXAMPLE | |
Show-BinaryFile -Path 'c:\path\to\binary.file' | |
This will read and output the entire binary file. |
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-FixedXOR { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[byte[]] $ByteArrayOne, | |
[Parameter(Mandatory = $true, Position = 1)] | |
[byte[]] $ByteArrayTwo | |
) | |
$combinedBytes = New-Object System.Collections.ArrayList |
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
Add-Type -MemberDefinition @' | |
[DllImport("crypt32.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
public static extern bool CryptStringToBinary( | |
[MarshalAs(UnmanagedType.LPWStr)] string pszString, | |
uint cchString, | |
CRYPT_STRING_FLAGS dwFlags, | |
byte[] pbBinary, | |
ref uint pcbBinary, | |
uint pdwSkip, |
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 ConvertTo-BinaryString { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline = $true, Mandatory = $true, Position = 0)] | |
[array] $InputObject, | |
[Parameter()] | |
[switch] $Pad | |
) |
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 ConvertTo-HexString { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline = $true, Mandatory = $true, Position = 0)] | |
[byte[]] $InputObject | |
) | |
BEGIN { | |
$outString = New-Object -TypeName System.Text.StringBuilder | |
} |
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-WinMerge { | |
<# | |
.SYNOPSIS | |
Wrapper for WinMerge. | |
.DESCRIPTION | |
PowerShell wrapper for WinMerge. Let's you launch file/folder comparison using WinMerge | |
from the PowerShell console. | |
.EXAMPLE | |
Invoke-WinMerge c:\temp\file1.txt c:\temp\file2.txt | |
Will launch WinMerge to compare file1.txt and file2.txt. |
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 ConvertTo-StringArray { | |
<# | |
.SYNOPSIS | |
Split a string on newline to produce a string array. | |
.NOTES | |
Author: Øyvind Kallstad | |
Date: 07.01.2016 | |
#> | |
[CmdletBinding()] | |
param ( |
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-SteamWishList { | |
<# | |
.SYNOPSIS | |
Get wishlist of Steam user | |
.DESCRIPTION | |
Get the wishlist of any public Steam user accounts. | |
.EXAMPLE | |
Get-SteamWishList user01 | |
Get the wishlist for Steam user account 'user01' | |
.NOTES |
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
$iterations = 10000 | |
$saveFile = 'C:\Users\grave\Scripts\OverheadTests\results.txt' | |
$m1Description = 'Refence: Only doing calculations' | |
Write-Host 'Starting Measurement 1' | |
$m1 = Measure-Command { | |
1..100 | ForEach-Object { | |
$_ + ($_ * $_) | |
} | |
} |
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-Square { | |
param([double]$Number) | |
$n = [math]::Abs($Number) | |
Write-Output ($n * $n) | |
} | |
#https://en.wikipedia.org/wiki/Root_mean_square | |
function Get-RootMeanSquare { | |
param ([double[]]$NumberSet) | |
$squaredNumberSet = New-Object System.Collections.ArrayList |