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 | |
# fanout utility - send stdin input to multiple target commands. | |
# | |
# Copyright (c) 2017 Michael Klement, released under the [MIT license](http://opensource.org/licenses/MIT). | |
# | |
# Aside from requiring Bash 3+, this utility should be portable: | |
# It uses only POSIX-compliant utilities with POSIX-compliant options. | |
# | |
# Invoke with --help for help. |
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-SpecialFolder { | |
<# | |
.SYNOPSIS | |
Gets special (known) folders. | |
.DESCRIPTION | |
Gets items representing special folders (directories), i.e., | |
folders whose purpose is predefined by the operating system. | |
In a string context, each such item expands to the full, literal path it |
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 New-CsvSampleData { | |
<# | |
.SYNOPSIS | |
Generates CSV sample data. | |
.DESCRIPTION | |
Generates simple CSV sample data as either a single multiline string or | |
an array of lines. | |
For now, the data-row field values are simply constructed as: |
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-DotNetCoreVersion { | |
<# | |
.SYNOPSIS | |
Gets version information about a .NET Core installation or project. | |
.DESCRIPTION | |
Gets version information about the globally installed .NET Core components | |
or a specific project. | |
Note: Requires PSv6+, due to use of type |
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-WithEnvironment { | |
<# | |
.SYNOPSIS | |
Invokes commands with a temporarily modified environment. | |
.DESCRIPTION | |
Modifies environment variables temporarily based on a hashtable of values, | |
invokes the specified script block, then restores the previous environment. | |
.PARAMETER Environment |
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
<# | |
.SYNOPSIS | |
A terminal-based implementation of Conway's Game of Life. | |
.DESCRIPTION | |
Conway's Game of Life is a zero-player game that simulates a cellular automaton. | |
See https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life for background. | |
The initial state can be seeded explicitly or, by default, randomly. |
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-OpenFiles { | |
<# | |
.SYNOPSIS | |
Finds open files. | |
.DESCRIPTION | |
Finds files currently being held open by any process and reports them as | |
[System.IO.FileInfo] instances, as Get-ChildItem would. | |
In fact, this function supports all parameters that Get-ChildItem does and |
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
<# | |
NOTE: | |
It is BEST TO DOT-SOURCE (.) THIS SCRIPT, which defines a function of the same | |
name for later use. | |
While it is possible to invoke this script directly, its help can then only | |
be invoked with the -? switch, providing only terse help, | |
whereas dot-sourcing provides full Get-Help integration. | |
Similarly, only with dot-sourcing do you get tab completion. |
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-MinPsVersionForCmdlet { | |
<# | |
.SYNOPSIS | |
Determines the minimum PowerShell version required for a given standard cmdlet. | |
.DESCRIPTION | |
NOTE: | |
* v3 or higher is required to run this function. | |
* Only cmdlets with help topics defined in the GitHub | |
PowerShell-documentation repository at |
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
<# | |
NOTE: | |
It is BEST TO DOT-SOURCE (.) THIS SCRIPT, which defines a function of the same | |
name for later use. | |
While it is possible to invoke this script directly, its help can then only | |
be invoked with the -? switch, providing only terse help, | |
whereas dot-sourcing provides full Get-Help integration. | |
Similarly, only with dot-sourcing do you get tab completion. | |
OlderNewer