Skip to content

Instantly share code, notes, and snippets.

View bender-the-greatest's full-sized avatar

bender-the-greatest

  • CSG International
  • Omaha, NE
View GitHub Profile
@bender-the-greatest
bender-the-greatest / format-json-function.ps1
Created December 5, 2016 20:18
Format-Json Function, allowing to specify the indent level.
function Format-Json {
Param(
[Parameter(ValueFromPipeline=$True,Mandatory=$True)]
[string]$jsondata,
[int]$indent=2
)
# Processing blocks are useful for multiline JSON strings
begin { $fullpipeline = "" }
process { $fullpipeline += $jsondata }
end {
@bender-the-greatest
bender-the-greatest / watch-function.ps1
Last active October 21, 2016 15:13
Rudimentary implementation of *nix watch command for Powershell
# Rudimentary implementation of *nix watch command for Powershell
# Tested under 2.0 and 5.1
# Example usage:
# watch ls
# watch 'echo "Command with parameters"'
# watch -n 1 'echo "Display this every second"'
# watch -n 1 -command 'echo "Explicit use of the command parameter"'
function watch {
Param(