Skip to content

Instantly share code, notes, and snippets.

View fatherjack's full-sized avatar
💭
doing things

fatherjack

💭
doing things
View GitHub Profile
git branch -m master main
git checkout main
git push -u origin main
now go to github.com and change the default branch ot main
created with reference to https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx
@fatherjack
fatherjack / EnterpriseFeaturesInUse.ps1
Last active March 12, 2020 07:52
Quick check to see if Enterprise Edition features are being used on an instance
# ref https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-persisted-sku-features-transact-sql
# script to locate Enterprise features that are in use
# might be something that forces an upgrade path
# might be worth running this in Dev and in CI pipeline to ensure no non-licensed features are incorporated into system development
$Server = "$ENV:COMPUTERNAME\sql2016"
$SMOServer = new-object ('Microsoft.SQLServer.Management.Smo.Server') $Server
@fatherjack
fatherjack / ReplaceRules_SP_DIAGNOSTICS_format
Last active January 10, 2020 13:20
ReplaceRules sp_server_diagnostics formatter
=====
For VSCode extension replacerules <https://marketplace.visualstudio.com/items?itemName=bhughes339.replacerules>
This needs to be placed in the settings.json file
dont forget to add a trailing comma to the content that you find there
and also close the final curly brace correctly
=====
"replacerules.rules": {
"Format sp_diagnostics results 01": {
"find": "><",
Function TimeToSQLBits {
<#
.Synopsis
Show how long you have to wait for the biggest data conference in Europe
.DESCRIPTION
Make sure you get prepared for the next SQLBits conference.
.EXAMPLE
TimeToSQLBits -purpose console
function Read-SQLConfigFile {
<#
.SYNOPSIS
Takes configuration file and shows features that are being set
.DESCRIPTION
Function to show what features and settings are being adjusted by the configuration file. Allows for comparison of
config files when combined with Compare-Object
.EXAMPLE
@fatherjack
fatherjack / New-ToDoList
Last active August 30, 2019 10:29
Creates a really quick To Do list in a notepad file, just when you want to make some notes for things to get done today
function New-ToDo {
<#
.SYNOPSIS
Creates quick To Do list in Notepad
.DESCRIPTION
Creates quick To Do list in Notepad
.PARAMETER List
comma separated list of items to put in to do list
@fatherjack
fatherjack / PowerShell Prompt.ps1
Last active August 23, 2019 21:32
provides some useful information to your PowerShell prompt
function Prompt {
<#
.Synopsis
Your custom PowerShell prompt
# borrowing heavily from https://dbatools.io/prompt but formatting the execution time without using the DbaTimeSpanPretty C# type
.Description
Custom prompt that includes the following features:
function Compare-Array
{
param(
[array]$Ref,
[array]$Diff
)
$max = [math]::Max($Ref.Length,$Diff.Length)
for($i = 0; $i -lt $max; $i++){
Function Change-Time {
<#
.SYNOPSIS
To convert a larger time measure to a smaller measure ie how many milliseconds in an hour
.DESCRIPTION
Function takes a duration(a) and a measure(b) and returns an amount in a preferred measure(c)
eg 4(a) hours(b) milliseconds(c)
"A curmudgeon’s reputation for malevolence is undeserved. They’re neither warped nor evil at heart. They don’t hate mankind, just mankind’s absurdities. They’re just as sensitive and softhearted as the next guy, but they hide their vulnerability beneath a crust of misanthropy. They ease the pain by turning hurt into humor. They attack maudlinism because it devalues genuine sentiment. Nature, having failed to equip them with a serviceable denial mechanism, has endowed them with astute perception and sly wit. Curmudgeons are mockers and debunkers whose bitterness is a symptom rather than a disease. They can’t compromise their standards and can’t manage the suspension of disbelief necessary for feigned cheerfulness. Their awareness is a curse. Perhaps curmudgeons have gotten a bad rap in the same way that the messenger is blamed for the message: They have the temerity to comment on the human condition without apology. They not only refuse to applaud mediocrity, they howl it down with morose glee. Their versions