Skip to content

Instantly share code, notes, and snippets.

View brettmillerb's full-sized avatar
🏠
Working from home

Brett Miller brettmillerb

🏠
Working from home
View GitHub Profile
@brettmillerb
brettmillerb / markdown.json
Created September 6, 2021 13:13
Jekyll Blog Post VSCode Snippet
{
// Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@brettmillerb
brettmillerb / setup.sh
Last active April 9, 2021 19:55
New Mac Setup
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
echo "Updating homebrew..."
brew update
@brettmillerb
brettmillerb / BeRightBack.html
Last active April 7, 2021 17:17
Twitch Stream Starting Animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
@brettmillerb
brettmillerb / Get-RandomString.ps1
Last active March 11, 2021 21:44
Get-RandomString
function Get-RandomString {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateRange(12,[int]::MaxValue)]
[int]
$StringLength,
[int]
$SpecialCharacters = 4
)
@brettmillerb
brettmillerb / packer.json
Created September 15, 2020 15:47
Packer Template Windows Updates
{
"builders": [
{
"capture_container_name": "vsts-buildimagetask",
"capture_name_prefix": "{{user `capture_name_prefix`}}",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"communicator": "winrm",
"image_offer": "{{user `image_offer`}}",
"image_publisher": "{{user `image_publisher`}}",
@brettmillerb
brettmillerb / DockerFile
Created April 5, 2019 21:59
Pwsh Dockerfile
# escape=`
ARG fromTag=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${WindowsServerCoreRepo}:${fromTag} AS installer-env
ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip
function Get-SendGridBouncedAddress {
[CmdletBinding()]
param (
[string[]]
$EmailAddress,
[string]
$Token
)
@brettmillerb
brettmillerb / Open-NativeApplication.ps1
Last active September 28, 2020 12:31
MacOS Open Pwsh Wrapper
function Open-NativeApplication {
[CmdletBinding()]
[Alias('open')]
param (
[Parameter()]
[ArgumentCompleter(
{
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
(Get-ChildItem /Applications).name -like "$WordToComplete*" | % {"'$_'"}
}
@brettmillerb
brettmillerb / HowTo.md
Last active August 28, 2020 23:54
Teams JSON String Creation of Teams Webhook Content

I wanted a way to dynamically build output in Azure Automation for a database migration.

# Create the internal sections first with ElasticPoolName and databases joined with \n\n (new line in Teams)
$sections = $dbsPerElasticPool | ForEach-Object {
    New-TeamsSection -ActivityTitle ('ElasticPool: **{0}**' -f $_.ElasticPool) -Value ($_.databases -join '\n\n')
}

# Create the rest of the card with the sections
$card = New-TeamsMessageCard -Sections $sections | ConvertTo-Json -Depth 5
@brettmillerb
brettmillerb / New-ObjectAttribute.ps1
Created August 25, 2020 23:27
Mindville API object functions
function New-ObjectAttribute {
[CmdletBinding()]
param (
[string]
$AttributeId,
[string]
$ObjectAttributeValue
)