Skip to content

Instantly share code, notes, and snippets.

## No
Do-Thing | Out-Null
## yes
$null = Do-Thing
[void](Do-Thing)
#How to migrate from AAP to RBAC
#region basic connects
$connectMgGraphSplat = @{
Scopes = @(
'AppRoleAssignment.ReadWrite.All',
'Application.ReadWrite.All',
'User.Read.All'
)
NoWelcome = $true
@JanDeDobbeleer
JanDeDobbeleer / .aliae.yaml
Last active December 5, 2023 12:50
Configs
alias:
- name: a
value: aliae
- name: g
value: git
- name: z
value: zoxide
- name: ls
value: exa -la --icons
if: hasCommand "exa"
@ChendrayanV
ChendrayanV / script.ps1
Last active November 10, 2023 11:11
A PowerShell Script to retrieve SCALAR properties value of the GitLab projects using GraphQL
param (
$Organization,
$PrivateToken,
$ProjectFullPath
)
$query = @{
query = '{
@mikefrobbins
mikefrobbins / gist:73757ca0c9c098d02e0758921a0d48d0
Last active October 2, 2023 12:44
Status of Azure VM Image
<#
Prerequisites
An Azure subscription is required.
Install the Az PowerShell module from the PowerShell Gallery:
Install-Module -Name Az
Login to Azure:
Connect-AzAccount
#>
@dfinke
dfinke / Clean-YouTubeTranscript.ps1
Last active September 17, 2023 12:43
This PowerShell script cleans up a YouTube transcript, from the Clipboard, for meeting notes
#Requires -Modules PowerShellAI
$str = Get-Clipboard
$prompt = "
Clean up this copy-paste from YouTube and make it suitable for pasting into Notion as meeting notes.
- Remove time stamps
- Remove line breaks
- Grammar, spell check and proper punctuation
$str
@adbertram
adbertram / timer.ps1
Created September 7, 2023 20:44
PowerShell Timer with Real-Time Counting
# Initialize timer variables
$timerStart = $null
$elapsedTime = $null
# Function to display elapsed time
function DisplayElapsedTime {
param (
[ref]$startTime,
[ref]$elapsedTime
)
@mikefrobbins
mikefrobbins / Disable-OnThisDayPhotoNotification.ps1
Last active August 3, 2023 18:48
Disable-OnThisDayPhotoNotification
# Disable the OneDrive "On This Day" photo memories notification in Windows 11.
New-ItemProperty -Path 'HKCU:\Software\Microsoft\OneDrive\Accounts\Personal\' -Name OnThisDayPhotoNotificationDisabled -Value 1 -PropertyType DWORD -Force
@mdgrs-mei
mdgrs-mei / TerminalSpinner.ps1
Created June 15, 2023 14:43
Show spinner on the Windows Terminal tabs for every command.
$global:originalPSConsoleHostReadLine = $function:global:PSConsoleHostReadLine
$global:originalPrompt = $function:global:Prompt
$function:global:PSConsoleHostReadLine = {
$startProgressIndicator = "`e]9;4;3;50`e\"
$command = $originalPSConsoleHostReadLine.Invoke()
$startProgressIndicator | Write-Host -NoNewLine
$command
}
@ShaunLawrie
ShaunLawrie / spinner.ps1
Last active July 13, 2023 00:14
A Basic "Spinner" in PowerShell
# Do some work
Write-Host "Doing some work"
$job = Start-Job {
Start-Sleep -Seconds 5
}
# Spinner
$location = $Host.UI.RawUI.CursorPosition
$spinnerIcons = @(". ", ".. ", "...")
$spinnerIconIndex = 0