Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
stuartleeks / helpers.sh
Last active April 6, 2020 13:32
wcode - launch VS Code in Windows from WSL (using \\wsl$\... path)
wcode() { cmd.exe /C code ''$(wslpath -w $1)''; }
wcode-insiders() { cmd.exe /C code-insiders ''$(wslpath -w $1)''; }
@stuartleeks
stuartleeks / devcontainer.sh
Last active July 7, 2020 06:48
devcontainer
# usage: `devcontainer <partial container name or mount path>`
#function devcontainer(){ docker exec -it $(docker ps -q | xargs docker inspect --format "{{.ID}} {{.Name}} {{range .Mounts}}{{.Source}}|{{end}}" | grep $1 | awk '{print $1}') bash; }
# replaced by https://github.com/stuartleeks/devcontainer-cli/
@stuartleeks
stuartleeks / README.md
Last active December 4, 2019 10:14
Quick kubectl config

NOTES

Quick script that I can drop in to set up kubectl completion and aliases etc

wget -q -O - https://gist.githubusercontent.com/stuartleeks/29e58601de67f270f27ee240d7b0a5e3/raw/setup.sh | bash
@stuartleeks
stuartleeks / profile-azbrowse.json
Created November 7, 2019 17:53
Windows Terminal config snippets
// profile for azbrowse (including navigating to subscription - hint: update the subscription id)
{
"acrylicOpacity": 0.5,
"closeOnExit": true,
"colorScheme": "Ubuntu-sl",
"commandline": "C:\\Windows\\System32\\bash.exe -c \"azbrowse navigate /subscriptions/00000000-0000-0000-0000-000000000000\"",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Fira Code",
"fontSize": 14,
@stuartleeks
stuartleeks / profiles.json
Created August 5, 2019 18:26
Windows Terminal config
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@stuartleeks
stuartleeks / main.go
Created July 3, 2019 09:05
Storage Management Lifecycle Policy test - Go SDK
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage"
"github.com/Azure/go-autorest/autorest/azure/auth"
)
@stuartleeks
stuartleeks / Links.md
Last active July 7, 2021 15:23
Build 2019 - BRK3037 - From dev to production: Container lifecycle, monitoring, logging and troubleshooting
@stuartleeks
stuartleeks / trip-status.sh
Created April 10, 2019 14:50
DevOpsOpenHack
#!/bin/bash
blue="\e[1;34m"
green="\e[1;32m"
no_colour="\e[1;0m"
PROD=$(kubectl get service api-trip-svc-prod --output=jsonpath={.spec.selector.slot})
echo -e "ProdColour: ${!PROD}$PROD$no_colour"
echo
@stuartleeks
stuartleeks / Verify-DeploymentGuid.ps1
Last active January 19, 2021 10:13 — forked from bmoore-msft/Verify-DeploymentGuid.ps1
Fetch the resources tagged in a pid-[GUID] deployment
<#
This is an update of the original script to work with the Az PowerShell module: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.0.0
Use this script to retrieve the resources that were deployed with a pid-[GUID] tag
Select-AzSubscription before running the script - it must be run within the subscription context of the deployment
The GUID and resourceGroup name of the deployment are required params
#>
Param(
[GUID][Parameter(Mandatory=$true)]$guid,
[string][Parameter(Mandatory=$true)]$resourceGroupName
@stuartleeks
stuartleeks / alias
Last active July 5, 2018 09:52
.azure/alias
[group-kill {{rg}}]
command = group delete -g {{rg}} --yes --no-wait
[get-subscription-id]
command = account show --query id -o tsv
#subscriptionId=$(az get-subscription-id)
[deployment-operation-summary {{rg}} {{name}}]
command = group deployment operation list -g {{rg}} -n {{name}} --query "[].{operationId:operationId, state:properties.provisioningState, resourceType: properties.targetResource.resourceType, resourceName:properties.targetResource.resourceName}"