Skip to content

Instantly share code, notes, and snippets.

View mark3grahams's full-sized avatar
🏠
Working from home

mark3grahams

🏠
Working from home
View GitHub Profile
@Jaykul
Jaykul / About Copilot CLI.md
Created April 30, 2023 22:55
Copilot CLI in PowerShell

We are, for now, just using the official github copilot CLI, but they didn't really have hooks for PowerShell, so I wrote a few functions to implement it.

It works great, as you can see:

a simple prompt for how to find the top 10 files

the modified query, executed

@Jaykul
Jaykul / Grouping.psm1
Created April 14, 2023 22:18
Expand and Group objects when they have (or could be deduped with) a single array property
filter Expand-Property {
<#
.SYNOPSIS
Expands an array property, creating a duplicate object for each value
.EXAMPLE
[PSCustomObject]@{ Name = "A"; Value = @(1,2,3) } | Expand-Property Value
Name Value
---- -----
A 1
@JustinGrote
JustinGrote / CodeTunnel.ps1
Last active April 20, 2024 05:30
Visual Studio Code Tunnel bootstrap via PowerShell (works in Azure Cloud Shell)
#require -version 5.1
#Usage: iwr https://tinyurl.com/VSCodeServer | iex
#Parameterized usage: & ([ScriptBlock]::Create((iwr https://tinyurl.com/VSCodeServer))) -Your -Options
param(
#Path to install the vscode binary to. This defaults to a folder in your Local AppData path. Must be writable by your current user without sudo
[ValidateNotNullOrEmpty()]
[string]$InstallPath = $(Join-Path -Path ([System.Environment]::GetFolderPath('LocalApplicationData')) -ChildPath 'vscode-cli'),
#Installation architecture. This is normally autodetected.
$Arch,
$OS,
@JustinGrote
JustinGrote / Get-MgServicePrincipalPermission.ps1
Last active November 6, 2024 10:21
Get a list of application and delegated permissions for a service principal, similar to what the Azure Portal shows
#requires -version 7 -module Microsoft.Graph.Applications
using namespace Microsoft.Graph.PowerShell.Models
using namespace System.Collections.Generic
enum MicrosoftGraphServicePrincipalType {
Application
Delegated
}
class MgServicePrincipalPermission {