This file contains hidden or 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
$documentsFolderPath = $([Environment]::GetFolderPath('Personal')) | |
# other ENUM values are here: | |
# https://learn.microsoft.com/en-us/dotnet/api/system.environment.specialfolder |
This file contains hidden or 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 Find-EmptyFolders { | |
Param( | |
[string]$Path = $pwd, | |
[int]$MaxDepth = 0, | |
[switch]$IgnoreAccessDenied, | |
[switch]$IncludeHidden, | |
[System.Management.Automation.FlagsExpression`1[System.IO.FileAttributes]]$FileAttributes | |
) | |
$getParams = @{ |
This file contains hidden or 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 {any[]} input | |
* @param {Object} filter | |
* @param {(RegExp|string)} filter.match | |
* @param {(string|string[])} filter.property | |
* @param {boolean} [filter.regularExpression=false] | |
* @param {boolean} [filter.caseSensitive=false] | |
* @param {boolean} [filter.multiline=false] | |
*/ | |
function filterArray(input, filter) { |
This file contains hidden or 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
#!/bin/bash | |
ID="$1" | |
MAC=$(grep -Ei '^[A-Z0-9]+$' <<<"$ID") | |
if [ -z "$MAC" ]; then | |
MAC=$(/etc/asterisk/scj/sipmac.sh "$ID") | |
if [ -z "$MAC" ]; then | |
echo "$ID was not found" >&2 |
This file contains hidden or 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
<# as a one-liner... because why not. #> | |
git ls-remote --tags https://go.googlesource.com/go | ForEach-Object { if ($_ -imatch ('^\s*(?<Commit>[0-9a-f]+)\s+refs/tags/go(?<Version>\d+\.\d+(?:\.\d+)?)\s*$')) { [PSCustomObject]@{Commit=$matches.Commit;Version=[Version]$matches.Version} } } | Sort-Object -Property Version -Descending -Top 1 |
This file contains hidden or 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
// these are just suggestions and examples... | |
const TestableTypes = { | |
"undefined" : "undefined", | |
"null" : "null", | |
"object" : "object", | |
"Object" : "Object", | |
"boolean" : "boolean", | |
"Boolean" : "Boolean", | |
"number" : "number", |
This file contains hidden or 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
\b(?:(?<International>[A-Z]{2}[0-9]{9}[A-Z]{2})|(?<FedEx>[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?(?:[0-9]{3})?)|(?<UPS>(?:(?:(?:1Z)[0-9A-Z]{16})|(?:(?:T)[0-9A-Z]{15}[0-9])|(?:[0-9]{9})|(?:[0-9]{26})))|(?<USPS>(?:(?:(?:93|92|94|95)[0-9]{2} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{2,4})|(?:(?:70|14|23|03)[0-9]{14})|(?:(?:M0|82) ?[0-9]{3} ?[0-9]{3} ?[0-9]{2})|(?:(?:[A-Z]{2})[0-9]{9}(?:[A-Z]{2})))))\b |
This file contains hidden or 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 Search-FileAccess { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$IdentityReferenceRegex, | |
[Parameter(Mandatory=$true)] | |
[string]$Path, | |
[Boolean]$Recurse=$true, | |
[switch]$Visualization | |
) |
This file contains hidden or 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
= | |
ARRAY_CONSTRAIN( | |
SORT( | |
FILTER( | |
range, | |
MAP( | |
range, | |
LAMBDA( | |
cell, | |
ISDATE(cell) |
This file contains hidden or 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-FilesFromGithubLatestRelease { | |
# original function from https://github.com/microsoft/winget-cli/issues/1861#issuecomment-1193136622 | |
param ( | |
[parameter(Mandatory)][string]$Project, # e.g. paintdotnet/release | |
[parameter(Mandatory)][string[]]$Patterns, # regex | |
[switch]$Prerelease | |
) | |
$releases = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$Project/releases" | |
$release = $releases | Where-Object { $_.prerelease -eq $Prerelease } | Select-Object -First 1 |