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
$Webpage = iwr http://tugait.pt/2017/speakers/
$SpeakersImages = $webpage.Images.Where{$_.class -eq 'speaker-image lazyOwl wp-post-image'}.src
$Faces = @()
foreach($URL in $SpeakersImages)
{
$jsonBody = @{url = $URL} | ConvertTo-Json
$apiUrl = "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur"
$apiKey = 'c9c98da91bbb4b1490bd24e136353766'
$headers = @{ "Ocp-Apim-Subscription-Key" = $apiKey }
@SQLDBAWithABeard
SQLDBAWithABeard / gist:680db5d8d5635f1da414fb78a2971a9e
Created November 22, 2016 07:06
dbareports agent info table and code
USE [DBADatabase]
GO
/****** Object: Table [Info].[Alerts] Script Date: 21/11/2016 16:50:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@SQLDBAWithABeard
SQLDBAWithABeard / find-DBAAgentJob.Tests.ps1
Created November 8, 2016 20:43
Pester test for find-dbaagentjob mocking connect-sqlserver
#Generic tests at the top - interesting stuff at line 108
$Here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace('.Tests.', '.')
. "$here\$sut"
"$here\$sut"
. "$Here\SharedFunctions.ps1"
Import-Module PSScriptAnalyzer
$Rules = Get-ScriptAnalyzerRule
$Name = $sut.Split('.')[0]
# There must be a better way to do this
$Sps = $srv.Databases['DBA-Admin'].StoredProcedures.Where{$_.Schema -eq 'dbo'}.Name
$Return.OlaProcs = $true
$I = 4
if($Sps -notcontains 'CommandExecute')
{$I --}
if($Sps -notcontains 'DatabaseBackup')
{$I --}
if($Sps -notcontains 'DatabaseIntegrityCheck')
{$I --}