Skip to content

Instantly share code, notes, and snippets.

View B4Art's full-sized avatar
🏠
Working from home

Bart van den Donk B4Art

🏠
Working from home
  • Amersfoort, The Netherlands
View GitHub Profile
@B4Art
B4Art / ps-colours.ps1
Last active December 14, 2020 12:56 — forked from timabell/ps-colours.ps1
output all the colour combinations for text/background in powershell
# output all the colour combinations for text/background
# http://stackoverflow.com/a/41954792/10245
$colors = [enum]::GetValues([System.ConsoleColor]) |
Select-Object @{N='ColorObject';E={$_}},
@{N='ColorName'; E={
If ($_.ToString().substring(0,3) -eq 'Dar' ){
$_.ToString().Substring(4) + 'DARK'
} else {
$_.ToString()
}
@B4Art
B4Art / Get-Between.ps1
Last active January 26, 2021 19:53
Select Noteproperty from a List via TabCompletion
<#
Skip the outermost records based on a column of a list
OR
Do the opposit and select the outermost records based on a column of a list
Use Tabcompletion to select the column
Get-Between -list $a.people -NotePropertyName <tabcomplete> [name or age]
Age will give:
@B4Art
B4Art / Get-ISO8601Week
Last active February 16, 2021 08:24
Get the correct ISO8601 week number
function Get-ISOWeek {
Param(
[Parameter(
# Mandatory,
ValueFromPipeline,
ValueFromPipelineByPropertyName,
HelpMessage = 'Valid Date'
)]
[Alias('DT', 'DateTime')]
[datetime[]]$Dates = (Get-Date),
<#
Place this file in the Modules Folder under .\Get-ISOWeek
The subfolder should have the same name as this File
#>
<#
Write-Host " Culture: " -NoNewline
(20..31).ForEach( { Get-ISO8601Week("2012-12-$($_)") -Verbose }) + ((1..7).ForEach( { Get-ISO8601Week("2013-1-$($_)") -Verbose })) -join ', '
#>