Skip to content

Instantly share code, notes, and snippets.

View jhoneill's full-sized avatar

James O'Neill jhoneill

View GitHub Profile
<?xml version="1.0" encoding="utf-8" ?>
<!-- *******************************************************************
Copyright (c) James O'Neill 2022 - Shared under the MIT License https://mit-license.org/
Allows [consoleColor] to be used like this
ps > [ConsoleColor]::Red.Foreground("This is red")
ps > [ConsoleColor]::DarkYellow.Background([ConsoleColor]::red.Foreground("This is red on darkyellow"))
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<SelectionSets><SelectionSet>
<Name>FileSystemTypes</Name>
<Types>
<TypeName>System.IO.DirectoryInfo</TypeName>
<TypeName>System.IO.FileInfo</TypeName>
</Types>
</SelectionSet></SelectionSets>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
####
#### Proxy function to restore Writing the URI to verbose when calling Invoke-RestMethod
#### When calling out of a module -Verbose isn't inherited so the function fiddles verbosepreference as a parameter.
Function Invoke-RestMethod {
[CmdletBinding(DefaultParameterSetName='StandardMethod', HelpUri='https://go.microsoft.com/fwlink/?LinkID=2096706')]
<#
.ForwardHelpTargetName Microsoft.PowerShell.Utility\Invoke-RestMethod
.ForwardHelpCategory Cmdlet
#>
param(
@jhoneill
jhoneill / Remove-SoftDeletedAPIService.ps1
Last active July 14, 2021 08:07
Re-deploying the API management service fails and help says call the REST API: here's a script to do it.
<#
.synopsis
Remove Soft-deleted API Management service
.description
Re-deploying the API management service fails with a message
See https://aka.ms/apimsoftdelete
That says call the REST API. This does that.
#>
[cmdletbinding(SupportsShouldProcess=$true,confirmImpact='High' )]
param (
@jhoneill
jhoneill / demo.ps1
Last active February 15, 2022 08:17
# rev 0.2 added more comments, and made the regax a bit more precise.
function SplitEmUp {
param (
$paramString
)
#This regex will isolate quoted blocks e.g. " -example )( $quote "
# and will identify matching open and close () {} and [] even if nested.
$opensAndCloses = @'
(?x) # Allow comments and ignore spaces and line breaks in the layaout.
^(?> # Start and make the repeating group ‘atomic’.
#I created this to show how much there is on the MS Graph API.
#I pulled down the openapi (nee swagger) files for Users, users.actions, Users,functions and groups
#And using my https://github.com/jhoneill/PSGraph - my version of Kevin Marquette's graphViz Module
#this litte bit of script produced a graphical version
$paths = @()
$ParentHash = @{}
function hasParent {
# .synopsis if the parent isn't in the call recursively with the parent. Add item and its parent to the hash
param($path)
@jhoneill
jhoneill / Show-help.ps1
Created February 4, 2021 17:48
A PowerShell Productivity hack - put help in it's own window
function Show-Help {
<#
.Synopsis
Open help in "Show window" mode
#>
param (
[parameter(ValueFromPipeline=$true)]
[ArgumentCompleter({
param($commandName, $parameterName,$wordToComplete,$commandAst,$fakeBoundParameter)
[System.Management.Automation.CompletionCompleters]::CompleteCommand($wordToComplete)
@jhoneill
jhoneill / localhost.ipynb
Last active November 23, 2020 12:12
Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhoneill
jhoneill / PowerShellNotebookModule.ipynb
Last active November 23, 2020 18:06
Changes I made to the module
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.