View Join-OxfordComma.ps1
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 Join-OxfordComma { | |
[CmdletBinding(DefaultParameterSetName='And')] | |
[Alias('jox')] | |
param( | |
[Parameter(Mandatory,ValueFromPipeline)] | |
[string[]]$JoinList, | |
[Parameter(ParameterSetName='And')] | |
[switch]$And, | |
[Parameter(ParameterSetName='Or')] | |
[switch]$Or |
View cibuild
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
#!/usr/bin/env bash | |
set -e # halt script on error | |
echo | |
echo "------------------------------------------------------------------------------------------------------------------------" | |
echo | |
if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_BRANCH" == "comments" ]; then | |
echo "Building site for pull request for $TRAVIS_BRANCH..." | |
echo |
View Add-TimeSpan.sp1
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 Add-TimeSpan { | |
[CmdLetBinding(DefaultParameterSetName='TimeSpan')] | |
param( | |
[Parameter()] | |
[datetime]$Timestamp = (Get-Date), | |
[Parameter(Mandatory,ParameterSetName='TimeSpan')] | |
[timespan]$TimeSpan, | |
[Parameter(ParameterSetName='TimeSlice')] | |
[int]$Days, | |
[Parameter(ParameterSetName='TimeSlice')] |
View myboto3_client.py
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
import boto3 | |
from mylogger import logger,log_exception | |
def create_session(profile_name='default'): | |
logger.info(f'Creating new boto3 session with profile {profile_name}') | |
try: | |
return boto3.session.Session(profile_name=profile_name) | |
except: | |
raise Exception( log_exception() ) |
View Get-PSFollowFridayTweetText.ps1
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 Split-Array { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[String[]] $InputObject | |
, | |
[ValidateRange(1, [int]::MaxValue)] | |
[int] $Size = 10 | |
) | |
begin { $items = New-Object System.Collections.Generic.List[object] } |
View Get-ErrorCategory.ps1
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-ErrorCategory { | |
[CmdletBinding(DefaultParameterSetName = 'APIV1.1')] | |
param( | |
[Parameter(Mandatory, ParameterSetName = 'APIV1.1')] | |
[string]$StatusCode, | |
[Parameter(Mandatory, ParameterSetName = 'APIV1.1')] | |
[string]$ErrorCode, | |
[Parameter(Mandatory, ParameterSetName = 'APIV2')] | |
[string]$ErrorType |
View Invoke-DiceRoll.ps1
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-DiceRoll { | |
[Alias('idr','roll')] | |
[CmdletBinding()] | |
param( | |
[ValidatePattern( | |
'^(?:[1-9]|0[1-9]|1[0-9]|20)d(4|6|8|12|20|30|100)$', | |
ErrorMessage='Valid die types are d4,d6,d8,d10,d12,d20,d30,d100 rolled beteen 1 and 20 times. Your input was {0}. Please try again.' | |
)] | |
[string]$Roll = '2d6', | |
[switch]$Total |
View PSChangeLogTools .psm1
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
#Requires -Module PowerShellforGitHub | |
#Requires -Version 5.1 | |
# GitLog Class | |
# class definition created by ConvertTo-ClassDefinition at 3/31/2021 9:47:01 PM for object type PSCustomObject | |
class PSGitLog { | |
[String]$CommitId | |
[String]$ShortCommitId | |
[DateTime]$AuthorDate |
View 1-Intermediate.ps1
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
#requires -Version 7 | |
function Get-SumTotal { | |
[CmdLetBinding()] | |
param( | |
[Parameter(Mandatory,Position = 0,ValueFromPipeline)] | |
[ValidatePattern('^\d{1,10}$', ErrorMessage = '"{0}" does not match only numbers 0-9 with a maximum of 10.')] | |
#[ValidatePattern('^\d{1,10}$')] | |
#[ValidateScript({ if ($_ -notmatch '^\d{1,10}$') { throw ('{0}"{1}" does not match only numbers 0-9 with a maximum of 10.' -f [System.Environment]::NewLine,$_) } else { $true }})] | |
[string]$Value, |
View SearchADDnsRecord.psm1
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
#Requires -Version 5.1 | |
#Requires -Module ActiveDirectory | |
$script:ADRootDSE = Get-ADRootDSE | |
class ADDnsNode { | |
# AD Object Properties | |
[String]$Name | |
[String]$CanonicalName |
NewerOlder