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 / linux-badge.svg
Last active March 24, 2025 23:18
dbachecks status badges
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@SQLDBAWithABeard
SQLDBAWithABeard / ResourcesWithNoTagsFix.ps1
Last active May 30, 2022 12:17
To show some Azure Graph things
$rgwithwrongtags = $results #| where resourcebilling -eq 'somedefaultvalue'
$count = $rgwithwrongtags.Count
foreach ($resource in $rgwithwrongtags) {
$context = Get-AzContext
$excludedtypes = 'microsoft.compute/virtualmachines/extensions','microsoft.network/privatednszones/virtualnetworklinks','microsoft.network/privatednszones'
if ($resource.type -notin $excludedtypes) {
Set-BillingTag -resource $resource -billingtag $resource.rgbilling
}
else {
@SQLDBAWithABeard
SQLDBAWithABeard / Apollo 13, 1995
Last active May 27, 2022 12:07
SQL 2022 Contained
Houston, we have a problem.
You will need to add the link to the 2022 container when it is available to the docker compose file
@SQLDBAWithABeard
SQLDBAWithABeard / Get-MicrosoftTags.ps1
Last active May 27, 2022 15:25
get microsoft tags
function Get-MicrosoftTags {
$AllRepos = (iwr https://mcr.microsoft.com/v2/_catalog).content | ConvertFrom-Json
# $AllRepos.Repositories | where{ $_ -like '*sql*'}
if ($IsCoreCLR) {
$repo = $AllRepos.Repositories | Out-ConsoleGridView -OutputMode Single
}
else {
$repo = $AllRepos.Repositories | Out-GridView -Passthru
}
$Url = "https://mcr.microsoft.com/v2/{0}/tags/list" -f $repo
@SQLDBAWithABeard
SQLDBAWithABeard / powershell.json
Last active October 8, 2021 18:09
powershell vscode snippets
{
/*
These are PowerShell snippets which you can use in Visual Studio Code
To use them click File --> Preferences --> User Snippets and type PowerShell
or edit $env:\appdata\code\user\snippets\powershell.json
In general and in order I converted exisitng snippets like this
Replace `$ with $$
Replace \ with \\
Replace " with \"
\r for new line
@SQLDBAWithABeard
SQLDBAWithABeard / whatschanged.yaml
Last active August 10, 2021 03:04
azure repo which files have changed
- task: AzurePowerShell@5
displayName: Deploy Changes
inputs:
azureSubscription: ''
ScriptType: 'InlineScript'
Inline: |
# Get the changes for the current build
$webClient = New-Object Net.WebClient
$token = "Bearer $env:SYSTEM_ACCESSTOKEN"
$headers = @{ Authorization = $token }
@SQLDBAWithABeard
SQLDBAWithABeard / boxstarter.ps1
Created June 9, 2021 13:55 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@SQLDBAWithABeard
SQLDBAWithABeard / datacontroller.bicep
Last active May 26, 2021 10:54
bicepdatacontroller
// this is for a raw K8s installation
param name string
param customLocationName string
param tags object
param datacontrollerUserName string
@secure()
param datacontrollerPassword string
@secure()
@SQLDBAWithABeard
SQLDBAWithABeard / focusassisttoggle.ps1
Last active February 5, 2024 21:56
Focus Assist change with powershell hack
# Focus Assist Off
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("(^{ESC})")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("(Focus Assist)")
Start-Sleep -Milliseconds 200
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -Milliseconds 700
[System.Windows.Forms.SendKeys]::SendWait("{TAB}{TAB} ")
Start-Sleep -Milliseconds 500