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 / azure-pipelines.yml
Created July 7, 2022 08:59
Stackoverflow Pipelines Example
- task: AzureCLI@2
displayName: Check Azure Functions Deployed
env:
RESOURCE_GROUP: $(ResourceGroup)
FUNCTION_NAME: $(FunctionName)
inputs:
azureSubscription: Microsoft Azure Subscription
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
@brettmillerb
brettmillerb / Get-QuotaPercentage.ps1
Created January 18, 2022 15:27
PowerShell Azure Subscription Quota Percentage Helper Function
function Get-QuotaPercentage {
[CmdletBinding()]
param (
[Parameter(Mandatory,
ValueFromPipeline)]
$InputObject
)
process {
foreach ($item in $InputObject) {
@brettmillerb
brettmillerb / AdHealthCheck.ps1
Created December 8, 2021 12:37
AD Health Check Report - Really Old Example
[CmdletBinding()]
Param(
[String]$domainname = 'domain.com',
[String]$reportpath = "E:\ADHealthReport\",
[String]$percentlow = 10,
[String]$sendemailtime = "07.00A"
)
@brettmillerb
brettmillerb / Set-VSCodesettings.ps1
Created November 5, 2021 13:26
PowerShell function to set VSCode settings.json properties
function Set-VSCodeSetting {
<#
.SYNOPSIS
Function for setting VS Code settings from command line
.DESCRIPTION
This function allows programmatic update of VS Code settings.json file
.PARAMETER FontSize
The font size to set
@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 / 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 / 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 / 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 / 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`}}",
function Get-SendGridBouncedAddress {
[CmdletBinding()]
param (
[string[]]
$EmailAddress,
[string]
$Token
)