Skip to content

Instantly share code, notes, and snippets.

View nmbell's full-sized avatar

Nathan Bell nmbell

  • San Francisco Bay Area
View GitHub Profile
@nmbell
nmbell / Test-Path Proxy Demo.ps1
Created September 26, 2021 04:09
Demo of a proxy function that sets the execution status instead of returning a Boolean
function Set-ExecutionStatus
{
[CmdletBinding()]
[Alias('?$')]
Param
(
[Parameter(ValueFromPipeline = $true)]
[Bool]$Boolean
)
@nmbell
nmbell / Get-NetIPMask.ps1
Created April 20, 2021 01:08
Iron Scripter\2021-03-15 A PowerShell IP Challenge
function Get-NetIPMask
{
<#
.SYNOPSIS
Determines the network mask from either its routing prefix or IP address.
.DESCRIPTION
Determines the network mask from either its routing prefix or IP address.
.PARAMETER RoutingPrefix
@nmbell
nmbell / Get-NChooseK.ps1
Last active April 20, 2021 01:17
Iron Scripter\2021-02-09 Another PowerShell Math Challenge
function Get-NChooseK
{
<#
.SYNOPSIS
Returns all the possible combinations by choosing K items at a time from N possible items.
.DESCRIPTION
Returns all the possible combinations by choosing K items at a time from N possible items.
The combinations returned do not consider the order of items as important i.e. 123 is considered to be the same combination as 231, etc.
@nmbell
nmbell / HelpExampleSetup.ps1
Created April 12, 2021 03:13
Powdrgit Help Examples - Setup Script
# Set the location of the root folder
$rootFolder = 'C:\PowdrgitExamples'
$tempFolder = $Env:TEMP
If (!(Test-Path -Path $rootFolder))
{
# Create the root folder if necessary
New-Item -Path $rootFolder -ItemType Directory -Force -ErrorAction Stop | Out-Null
# Create a non-git folder