This file contains 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
$a -foobar $b # should not match | |
Invoke-Something -foobar | |
Invoke-Something -foobar value | |
Invoke-Something -foobar:$true | |
Invoke-Something -foobar: $true | |
Invoke-Something -p1 v1 -p2 10 -p3 'value' -switch -verbose | |
Invoke-Something -p1 {Get-Something} | |
Get-Something -p1 'Input' | Invoke-Something -p1 @('one','two','three') | ForEach-Object {$_} | |
Invoke-Something -parameter1 'value' ` | |
-parameter2 10 ` |
This file contains 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
$adPath = 'OU=Users,OU=Dev,DC=test,DC=local' | |
$adDomain = 'test.local' | |
$userPassword = 'aV3ryl0ng-and.securePASSWORD!!' | |
$users = Get-RandomUser -Amount 30 -Nationality gb,uk -ExcludeFields picture | Select-Object -ExpandProperty results | |
foreach ($user in $users) { | |
$newUserProperties = @{ | |
Name = "$($user.name.first) $($user.name.last)" | |
GivenName = $user.name.first |
This file contains 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-RandomUser { | |
<# | |
.SYNOPSIS | |
Generate random user data. | |
.DESCRIPTION | |
This function uses the free API for generating random user data from https://randomuser.me/ | |
.EXAMPLE | |
Get-RandomUser 10 | |
.EXAMPLE | |
Get-RandomUser -Amount 25 -Nationality us,gb -Format csv -ExludeFields picture |
This file contains 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
# testing psInlineProgress | |
$null = Start-Transcript -Path C:\users\grave\Scripts\InlineProgressBar\transcript.txt | |
Write-Host '' | |
# Simple progressBar | |
Write-Host 'Example of default behaviour' -ForegroundColor Magenta | |
Write-Host '' | |
$collection = 0..12 | |
$count = 0 |
This file contains 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 New-DummyFile { | |
<# | |
.SYNOPSIS | |
Create dummy file(s). | |
.DESCRIPTION | |
Quickly create a set of dummy files, with completely randomized names, | |
size and folder structure. | |
.EXAMPLE | |
'C:\Demo' | New-DummyFile -Files 10 -min 1kb -max 10kb | |
.EXAMPLE |
This file contains 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-PathShortener { | |
<# | |
.SYNOPSIS | |
Path Shortener | |
.NOTES | |
Author: Øyvind Kallstad | |
Date: 05.04.2016 | |
Version: 2 | |
#> | |
[CmdletBinding()] |
This file contains 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-PackageUpdate { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] $Name, | |
[Parameter()] | |
[string] $ProviderName | |
) | |
This file contains 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
param([Parameter(Position = 0)][string] $Path = 'C:\Users\grave\Downloads\ChessData-master\') | |
$code = @{ | |
Name = 'ResultCounter' | |
Namespace = 'ChessData' | |
PassThru = $true | |
UsingNamespace = @( | |
'System.Collections.Concurrent', | |
'System.IO', | |
'System.Threading.Tasks' | |
) |
This file contains 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-Digits { | |
<# | |
.SYNOPSIS | |
Convert an integer into an array of bytes of its individual digits. | |
.DESCRIPTION | |
Convert an integer into an array of bytes of its individual digits. | |
.EXAMPLE | |
ConvertTo-Digits 145 | |
.INPUTS | |
System.UInt64 |
This file contains 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-LuhnChecksum { | |
<# | |
.SYNOPSIS | |
Calculate the Luhn checksum of a number. | |
.DESCRIPTION | |
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, | |
is a simple checksum formula used to validate a variety of identification numbers, such as | |
credit card numbers, IMEI numbers, National Provider Identifier numbers in the US, and | |
Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn. | |
.EXAMPLE |