Skip to content

Instantly share code, notes, and snippets.

View taddison's full-sized avatar
👻
(⊙_⊙;)

Timothy Addison taddison

👻
(⊙_⊙;)
View GitHub Profile
@taddison
taddison / ConfigureDBMailWithSendGrid.sql
Created April 23, 2018 19:27
Configure DBMail with SendGrid
declare @mailFromDomain nvarchar(128) = N'@foo.com'
declare @username nvarchar(128) = 'apikey'
declare @password nvarchar(128) = 'SG.SECRETS';
declare @port int = 587;
declare @server nvarchar(128) = 'smtp.sendgrid.com'
declare @replyTo nvarchar(128) = 'donotreply' + @mailFromDomain;
declare @serverName nvarchar(128) = substring(@@servername,8,100);
declare @emailAddress nvarchar(128) = @serverName + @mailFromDomain;
declare @displayName nvarchar(128) = @serverName;
@taddison
taddison / DictionaryTryGetValue.csproj
Last active February 21, 2022 15:52
Dictionary TryGetValue Benchmark
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0;net5.0;netcoreapp3.1;net48;netcoreapp2.1</TargetFrameworks>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
@taddison
taddison / Program.cs
Last active September 1, 2021 19:19
Cache Key construction benchmark
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes;
using Microsoft.Extensions.Caching.Memory;
public class Program
{
public static void Main(string[] args) =>
BenchmarkSwitcher.FromAssemblies(new[] { typeof(Program).Assembly }).Run(args);
}
@taddison
taddison / index.html
Last active July 19, 2020 19:14
flexing
<div class="test">
<div>One</div>
<div>Two</div>
</div>
@taddison
taddison / deps.ps1
Created June 8, 2020 21:44
Powershell dependencies for SQLChecks
$majorVersion = $PSVersionTable.PSVersion.Major
$pesterModules = Get-Module -ListAvailable -Name Pester
$sqlserverModules = Get-Module -ListAvailable -Name SqlServer
$versionOk = $majorVersion -ge 7
$pesterOk = ($pesterModules | Where-Object { $_.Version.Major -eq 4 -and $_.Version.Minor -ge 10 } | Measure-Object).Count -ge 1
$sqlServerOk = ($sqlserverModules | Where-Object { $_.Version.Major -ge 21 -and $_.Version.Minor -ge 1 } | Measure-Object).Count -ge 1
if($versionOk -and $pesterOk -and $sqlServerOk) {
Write-Output "All dependencies ok"
@taddison
taddison / DumpAllWindowsPerformanceCounters.ps1
Created March 25, 2020 20:49
DumpAllWindowsPerformanceCounters
Connect-AzAccount
$allPerfCounters = @()
$subscriptions = Get-AzSubscription
foreach ($subscription in $subscriptions) {
$subscription | Set-AzContext
$workspaces = Get-AzOperationalInsightsWorkspace
foreach ($workspace in $workspaces) {
// npm install node-fetch
const fetch = require('node-fetch');
module.exports = async function (context, req) {
const body = req.rawBody || JSON.stringify({text: 'Hello World'});
if(!body) {
context.log('No request body found.');
return;
}
$payload = @"
{
"text": "Danny Torrence left a 1 star review for your property.",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Danny Torrence left the following review for your property:"
}
@taddison
taddison / Select.js
Created December 12, 2019 15:01
React select with styled components
import React from "react";
import styled from "styled-components";
const MinorSelect = styled.select`
appearance: none;
background-color: #edf2f7;
border: 0.0625rem solid grey;
border-radius: 0.5rem;
font-size: 1.5rem;
padding: 1rem;