I hereby claim:
- I am vexx32 on github.
- I am ta11ow (https://keybase.io/ta11ow) on keybase.
- I have a public key ASBjV0F0zB7el1gfWjEiPjwpe1RdXDwJ_GJQ1TZsJSfvigo
To claim this, I am signing this object:
function Test-PasswordLeaked { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, Position = 0, ValueFromPipeline)] | |
[PSCredential] | |
$Credential | |
) | |
begin { | |
$SHA1 = [System.Security.Cryptography.SHA1Managed]::new() | |
} |
type TransformToSKColorAttribute() = | |
inherit ArgumentTransformationAttribute() | |
let matchColor name = | |
seq { | |
match name with | |
| knownColor when ColorNames.Contains(knownColor) -> yield ColorLibrary.[knownColor] | |
| clear when String.Equals(clear, "transparent", StringComparison.OrdinalIgnoreCase) -> yield SKColor.Empty | |
| patternString when WildcardPattern.ContainsWildcardCharacters(patternString) -> | |
let pattern = WildcardPattern(patternString, WildcardOptions.IgnoreCase) |
# allow self-referential definitions | |
[Flags()] | |
enum Food { | |
Apple | |
Banana | |
Celery | |
Grape | |
Fruit = Apple -bor Banana -bor Grape | |
} |
function Invoke-PSNotification { | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] | |
param( | |
[Parameter(Position=0, Mandatory, ValueFromPipeline)] | |
[object[]] | |
$Body, | |
[string] | |
$Summary = 'PowerShell Notification', |
$Properties = 'GivenName', 'Surname', 'Department', 'EmailAddress', 'Office' | |
Get-ADUser -Filter 'Department -like "*"' -Properties $Properties | | |
Select-Object -Property $Properties | | |
ConvertTo-Csv -NoTypeInformation | # Convert to CSV string data without the type metadata | |
Select-Object -Skip 1 | # Trim header row, leaving only data columns | |
Set-Content -Path "c:\emailaddress.csv" |
/////////////////////////////////////// | |
////////// BENCHMARK RESULTS ////////// | |
/////////////////////////////////////// | |
// * Summary * | |
BenchmarkDotNet=v0.11.1, OS=Windows 10.0.17134.286 (1803/April2018Update/Redstone4) | |
Intel Core i3-3240 CPU 3.40GHz (Ivy Bridge), 1 CPU, 4 logical and 2 physical cores | |
Frequency=3312801 Hz, Resolution=301.8594 ns, Timer=TSC | |
.NET Core SDK=2.1.402 |
// Generic this --> multiple type handling | |
internal static bool TryConvertSByte(double value, out sbyte outValue) | |
{ | |
if (value < sbyte.MinValue || value > sbyte.MaxValue) | |
{ | |
outValue = 0; | |
return false; | |
} |
I hereby claim:
To claim this, I am signing this object:
if (suffix == 'u' || suffix == 'U') | |
{ | |
if (UInt32.TryParse(strNum, style, NumberFormatInfo.InvariantInfo, out uint u)) | |
{ | |
ulong testresult = u * (ulong) multiplier; | |
if (testresult > UInt32.MaxValue) | |
{ | |
result = testresult; | |
} | |
else |
$Module = New-Module -Name 'ImportMe' -ScriptBlock { | |
class TryMeException : System.Exception { | |
TryMeException() : base() {} | |
TryMeException([string]$Message) : base($Message) {} | |
} | |
$onremove = { | |
throw [TryMeException]::new("HOW DARE YOU STEAL THAT CAR") | |
} | |
$ExecutionContext.SessionState.Module.OnRemove += $onremove | |
} |