Skip to content

Instantly share code, notes, and snippets.

View tillig's full-sized avatar

Travis Illig tillig

View GitHub Profile
@tillig
tillig / Set-VSCodeAsMacOSDefaultEditor.ps1
Created January 23, 2024 20:19
Script to set VSCode as the default editor for select file types on MacOS
$duti = Get-Command "duti" -ErrorAction SilentlyContinue
If ($Null -eq $duti) {
throw "You must install 'duti' before running this script: brew install duti"
}
$duti = $duti.Source
# $vscode = com.microsoft.VSCode
$vscode = osascript -e "id of app `"Visual Studio Code`""
@tillig
tillig / Set-PersonalGitConfig.ps1
Created March 28, 2022 18:53
Conditional .gitconfig setup for separating personal from work settings.
git config -f ~/.gitconfig-personal user.name "Travis Illig"
git config -f ~/.gitconfig-personal user.email "tillig@paraesthesia.com"
git config --global includeIf.gitdir:~/dev/tillig/.path ~/.gitconfig-personal
git config --global includeIf.gitdir:~/dev/autofac/.path ~/.gitconfig-personal
@tillig
tillig / az-snippets.md
Created July 15, 2021 21:16
Helpful snippets for working with the az CLI

Service Principals

Get the service principal for an application by app ID:

az ad sp list --filter "appId eq 'APP-GUID-HERE'" --query "[].objectId" -o tsv

@tillig
tillig / brew-updates.1h.sh
Created February 12, 2021 21:37
BitBar plugin for checking Homebrew updates
#!/usr/local/bin/bash
# <bitbar.title>Homebrew Updates</bitbar.title>
# <bitbar.author>killercup</bitbar.author>
# <bitbar.author.github>killercup</bitbar.author.github>
# <bitbar.desc>List available updates from Homebrew (OS X)</bitbar.desc>
# Modified by tillig to account for:
# - brew 3 outputs brew update info to stderr
# - putting a 🍺 emoji in the bar helps so it's not just a floating number
exit_with_error() {
@tillig
tillig / Copy-AzureContainerImages.ps1
Created November 5, 2020 16:16
Copies all tagged container images from one Azure Container Registry to another.
<#
.SYNOPSIS
Copies all the container images from one Azure Container Registry to another.
.DESCRIPTION
The az CLI offers the ability to import one container registry image into an
ACR instance at a time. The artifact transfer mechanism that might be used
to bulk copy container images is in preview and is difficult to set up. This
script offers the best of all worlds - a bulk execution of the `az import`
command to bring all the images from one ACR into another.
@tillig
tillig / Delete-AzureContainerImages.ps1
Created November 5, 2020 16:15
Prunes the set of images in an Azure Container Registry.
<#
.SYNOPSIS
Trims down the set of images in an Azure Container Registry.
.DESCRIPTION
There isn't really a retention policy setting on ACR such that the last X
tags will be retained for a given repository. This script helps bridge that gap by
going through all the repositories in an ACR, selecting the latest X tags to ignore,
then removing tags that were created after that time.
.PARAMETER Registry
The name of the container registry with the images to prune.
@tillig
tillig / New-AzureContainerRegistry.ps1
Created November 5, 2020 16:14
Creates a new Azure Container Registry with customer managed keys enabled.
<#
.SYNOPSIS
Creates a new Azure Container Registry.
.DESCRIPTION
Creates a new Azure Container Registry instance with customer managed key
encryption enabled. Generates keys and identities for the registry.
The location of the registry is inferred from the location of the specified
Key Vault. This is because, when using customer managed keys, the Key Vault
and the resource being encrypted must be in the same geographic location.
@tillig
tillig / mac-install.sh
Last active April 8, 2022 18:14
Automated environment setup for Mac
NAME="Travis Illig"
EMAIL="travis.illig@fiserv.com"
USER="tillig"
echo "MAC ENVIRIONMENT SETUP"
echo "----------------------"
echo "Sign in to Mac App Store before proceeding. Homebrew package restore may need to restore app store items."
read -p "Press any key to continue… " -n1 -s
echo ""
@tillig
tillig / Switch-NodeJs.ps1
Last active April 22, 2021 20:48
Switch versions of Node.js using Homebrew
# From
# https://medium.com/@katopz/how-to-install-specific-nodejs-version-c6e1cec8aa11
# See node versions
brew search node
# Remove the existing symlinks
brew unlink node
# Install node at specific version
@tillig
tillig / UnitTest.sublime-commands
Created March 15, 2019 20:28
User-level script to convert NUnit test fixtures to Xunit with simple regex replacement.
[
{
"caption": "Unit Test: NUnit to XUnit",
"command": "nunit_to_xunit"
},
{
"caption": "Unit Test: NUnit to XUnit (Batch)",
"command": "nunit_to_xunit_batch"
}
]