Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View SQLDBAWithABeard's full-sized avatar
🦄
Generally bearding

Rob Sewell SQLDBAWithABeard

🦄
Generally bearding
View GitHub Profile
@SQLDBAWithABeard
SQLDBAWithABeard / remove-filesystemitem.ps1
Last active April 11, 2024 16:02
cant remove unempty dorectories
function Remove-FileSystemItem {
<#
.SYNOPSIS
Removes files or directories reliably and synchronously.
.DESCRIPTION
Removes files and directories, ensuring reliable and synchronous
behavior across all supported platforms.
The syntax is a subset of what Remove-Item supports; notably,
@SQLDBAWithABeard
SQLDBAWithABeard / Trace-AICommand.ps1
Created June 27, 2022 09:15 — forked from JustinGrote/Trace-AICommand.ps1
Report the results and performance of any scriptblock to Azure Application Insights
#requires -version 7
#You can load this script with $(iwr https://tinyurl.com/TraceAICommand | iex)
using namespace Microsoft.ApplicationInsights
using namespace Microsoft.ApplicationInsights.Extensibility
using namespace Microsoft.ApplicationInsights.DataContracts
using namespace System.Management.Automation
using namespace System.Collections.Generic
using namespace System.Net
#Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console
1..100 | ForEach-Object {
$number = $Psitem
switch (($number % 5) -eq 0 -and ($number % 3 -eq 0)) {
$true { 'FizzBuzz' }
Default {
switch ($number % 3) {
0 { 'Fizz' }
Default {
switch ($number % 5) {
0 { 'Buzz' }
@SQLDBAWithABeard
SQLDBAWithABeard / prompt.ps1
Last active March 21, 2024 07:16
new improved colourful prompt
######## POSH-GIT
# with props to https://bradwilson.io/blog/prompt/powershell
#
#
# Now for this to work most beautifully - you will need to have the latest posh-git module
#
# You will also need the MesloLGM Nerd Font Mono font
# from here https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Meslo/M/Regular/complete/Meslo%20LG%20M%20Regular%20Nerd%20Font%20Complete.ttf
# if you are super nerdy
# or
@SQLDBAWithABeard
SQLDBAWithABeard / chocolately.ps1
Last active April 13, 2022 14:39
Laptop install
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chocolatey -y
choco install 1password -y
choco install azure-data-studio -y
choco install azure-functions-core-tools-3 -y
choco install azure-cli -y
choco install bicep -y
choco install chocolatey-core.extension -y
@jstangroome
jstangroome / gist:3087453
Created July 11, 2012 01:58
Change your own Active Directory password from PowerShell without any special permissions
([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword')