Skip to content

Instantly share code, notes, and snippets.

View petervandivier's full-sized avatar
🌶️
Why is it spicy?

Peter Vandivier petervandivier

🌶️
Why is it spicy?
View GitHub Profile

This is a markdown file.

graph TD;
    A(with a mermaid diagram)-->B;
    A-->C;
    B-->D;
    C-->D(embedded inside);
@petervandivier
petervandivier / money-divide-money-is-money.sql
Created September 5, 2018 13:03
money ÷ money = datatype?
https://stackoverflow.com/a/582867/4709762
/*
? Money / Money = Float
X Money / Money = Money
Learning Feb 24 '09 at 18:23
how many 1 cent coins can a dollar bill get you? an answer to this requires money / money.
Richard Feb 24 '09 at 18:50
@petervandivier
petervandivier / parallel-begin-process-end.ps1
Created May 26, 2023 17:42
ValueFromPipeline processing in a function is serial unless you use a steppable pipeline
#Requires -PSEdition Core
# HT @santisq in powershell-slack
# https://powershell.slack.com/archives/C1RCWRDL4/p1685120926413089
function foo {
param(
[Parameter(Mandatory,ValueFromPipeline)]
[string]
$bar
function New-DateArray {
<#
.EXAMPLE
$days = New-DateArray '2021-01-01' '2021-02-01'
$days | % { $_.ToShortDateString() }
#>
[CmdletBinding()]
Param(
[Parameter()]
URL Status
https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/blob/dev/Documentation/sp_Blitz%20Checks%20by%20Priority.md. 404
https://www.BrentOzar.com/go/blitztour 404
http://FirstResponderKit.org. 404
https://BrentOzar.com/go/poison/# 400
https://BrentOzar.com/go/nas 404
https://BrentOzar.com/go/planlimits 301
https://BrentOzar.com/go/makeparallel 301
https://BrentOzar.com/go/dbscope 404
https://www.BrenOzar.com/go/azurevm
@petervandivier
petervandivier / !README.md
Last active July 7, 2022 16:07
Pester PS Class

I'm attempting (and failing) to run a data-driven Pester v5 test over a PS Class. In the Tests/ directory are the 3 (currently failing) implemetations.

@petervandivier
petervandivier / Get-ClusterDiskSpacePivot.ps1
Last active June 6, 2022 12:34
Get-ClusterDiskSpacePivot
$ComputerList = 1..4 | ForEach-Object {"node-0${_}"}
$LocalHostName = hostname
$disks = foreach($computer in $ComputerList){
if($LocalHostName -eq $computer){
Get-PSDrive -PSProvider FileSystem
}else{
Invoke-Command -ComputerName $computer{
Get-PSDrive -PSProvider FileSystem
}
}
@petervandivier
petervandivier / sql2019_showplanxml.xsd
Created May 26, 2022 13:56
schemas.microsoft.com_sqlserver_2004_07_showplan_sql2019_showplanxml.xsd
<xsd:schema xmlns:shp="http://schemas.microsoft.com/sqlserver/2004/07/showplan"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/showplan" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1.539" blockDefault="#all">
<xsd:annotation>
<xsd:documentation> The following schema for Microsoft SQL Server describes output from the showplan
functionality in XML format. Microsoft does not make any representation or warranty regarding the schema or
any product or item developed based on the schema. The schema is provided to you on an AS IS basis.
Microsoft disclaims all express, implied and statutory warranties, including but not limited to the implied
warranties of merchantability, fitness for a particular purpose, and freedom from infringement. Without
@petervandivier
petervandivier / Get-EbsDeets.ps1
Last active May 6, 2022 13:06
Get VolumeID and BlockDeviceName from EC2 Drive Letter
function Get-EbsDeets {
[cmdletbinding()]Param(
[string[]]$DriveLetter
)
# $wmiVol = Get-WmiObject Win32_Volume | Where DriveLetter -eq "$DriveLetter`:"
$wmiLd = Get-WmiObject Win32_LogicalDisk | Where {($_.DeviceID).Trim(':') -in $DriveLetter}
$wmiLd | ForEach-Object {
$Letter = $_.DeviceID
@petervandivier
petervandivier / Merge-ObjectArray.ps1
Created November 24, 2021 17:03
Merge-ObjectArray.ps1
function Merge-ObjectArray {
<#
.DESCRIPTION
Converts an array of objects into a single object with all constituent
properties of each input. If a synonymous property is detected between
inputs, the value is overwritten and a warning is raised but the merge
continues.
.EXAMPLE
$foo = @{foo=1}