Skip to content

Instantly share code, notes, and snippets.

View johnkors's full-sized avatar

John Korsnes johnkors

View GitHub Profile
@johnkors
johnkors / ReducedHttpClientFactoryLogging.cs
Last active November 9, 2020 15:55
Alter HttpClientFactory log statements
using System;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Http;
using Microsoft.Extensions.Http.Logging;
using Microsoft.Extensions.Logging;
@johnkors
johnkors / azure-pipelines.yml
Created April 29, 2020 12:07
Azure Pipelines using a stage template
trigger:
paths:
include:
- infrastructure/*
stages:
- template: 'templates/deploy_infra_stage.yml'
parameters:
environment: 'test'
hostname: 'myservice-test.domain.com'
- template: 'templates/deploy_infra_stage.yml'
@johnkors
johnkors / deploy_infra_stage.yml
Last active April 29, 2020 12:10
Infra stage ARM deploy
parameters:
environment: ''
hostname: ''
stages:
- stage: deploy_infra_${{ parameters.environment }}
variables:
resourceGroupName: 'myservice-${{ parameters.environment }}-rg'
baseResourceName: 'myservice'
environment: ${{ parameters.environment }}
keyvaultId: 'common-${{ parameters.environment }}-kv'
@johnkors
johnkors / trackingqueryparams
Created April 1, 2020 12:17
tracking query params
verboten = [
# google
'utm_source'
, 'utm_medium'
, 'utm_content'
, 'utm_campaign'
, 'utm_term'
, 'ei'
, 'gs_l'
@johnkors
johnkors / azure-pipelines.yml
Last active February 24, 2020 12:36
Azure Pipelines to create a deploy artifact and deploy to Azure App Service on Linux
stages:
- stage: CreateArtifacts
jobs:
- job: CreatesArtifacts
steps:
- script: dotnet publish -c Release ./src/MyProj/MyProj.csproj
- upload: ./src/MyProj/bin/Release/netcoreapp3.1/publish/
artifact: myprojartifact
- stage: Deploy
jobs:
@johnkors
johnkors / .sshconfig
Created October 20, 2019 04:42
SSH config working with Azure DevOps and others
# https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops#i-have-multiple-ssh-keys--how-do-i-use-different-ssh-keys-for-different-ssh-servers-or-repos
Host ssh.dev.azure.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa.azureaccount
IdentitiesOnly yes
User git
Host *
@johnkors
johnkors / Dockerfile
Created August 7, 2018 11:34
Dockerfile to build .NET Core using Cake on Ubuntu (Mono+Git+.NET SDK)
FROM ubuntu:16.04
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
# Enable SSL
RUN apt-get update \
&& apt-get install -y apt-transport-https curl tzdata git \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb http://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
@johnkors
johnkors / rider.bat
Last active May 3, 2018 08:57
Launch cmder as integrated terminal in JetBrains Rider
@echo off
SET CMDER_ROOT=C:\tools\cmder
"cmd" /k ""%CMDER_ROOT%\vendor\init.bat""
@johnkors
johnkors / wifi.ps1
Created March 22, 2018 12:41
List all wifi pwds
#Make a list with all WiFi SSID's and passwords stored locally on Windows OS.
$output = netsh.exe wlan show profiles
$profileRows = $output | Select-String -Pattern 'All User Profile'
$profileNames = New-Object System.Collections.ArrayList
#for each profile name get the SSID and password
for($i = 0; $i -lt $profileRows.Count; $i++){
$profileName = ($profileRows[$i] -split ":")[-1].Trim()
@johnkors
johnkors / docker-prune.ps1
Created March 12, 2018 14:28
docker-prune.ps1
docker ps -a -q -f status=exited -f status=created | foreach-object {docker rm -f $PSItem.toString() }
docker images | select-string "<none>" | ConvertFrom-String) | Select -ExpandProperty "P3"