Skip to content

Instantly share code, notes, and snippets.

@johanclasson
johanclasson / config.yml
Created March 15, 2024 10:14
lazygit config
git:
skipHookPrefix: WIP
autoFetch: true
autoRefresh: true
fetchAll: true
branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName} --}
allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
overrideGpg: false
disableForcePushing: false
parseEmoji: false

Prepare

docker system prune -a -f
az login
az account set -s "Visual Studio Ultimate med MSDN"
az group create -g demo-rg -l swedencentral
az acr create -n classon -g demo-rg -l swedencentral --sku Basic
az group delete -g demo-rg -y
@johanclasson
johanclasson / Get-ReleaseNotes.ps1
Last active November 9, 2019 19:31
Script that downloads custom fields for release notes from Azure DevOps work items and outputs markdown.
param (
[string]$Pat = $env:AzureDevOpsReleaseNotesPat,
[string]$Organization = $env:AzureDevOpsReleaseNotesOrganization,
[string]$Project = $env:AzureDevOpsReleaseNotesProject,
[string]$Query = 'My Queries/Release Notes',
[string]$Header = 'Release Notes',
[switch]$IncludeUrls
)
$ErrorActionPreference = 'Stop'
internal class MyContext : DbContext
{
// ...
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured) // This prevents multiple configurations
{
optionsBuilder.UseSqlite(@"Data Source=c:\temp\mydatabase.sqlite;");
}
// ...
using (var factory = new TestContextFactory())
using (var context = factory.CreateInMemorySqlite<MyContext>(migrate: true))
{
RunScenario(context);
}
// Or...
using (var factory = new TestContextFactory())
using (var context = factory.CreateInMemoryDatabase<MyContext>())
{
RunScenario(context);
using System;
using System.Data.Common;
using Microsoft.Data.Entity;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.DependencyInjection;
namespace EF.TestUtils
{
public sealed class TestContextFactory : IDisposable
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$Source,
[Parameter(Mandatory=$True)]
[string]$Target
)
gci $Source -Recurse -Filter ".git" -Force -Directory | %{
$dir = Join-Path (Join-Path $target $_.Parent.Name) ".git"
param([string]$SourceDir = $env:BUILD_SOURCESDIRECTORY,
[string]$TempDir = $env:TEMP)
$ErrorActionPreference = "Stop"
<#
Pester is downloaded to the local user temp directory instead of the build source
folder because of two reasons:
* It can be reused between runs on the same machine.
* Pester is actually tested by tests written in Pesters own test framework, and
they are included in the module source. To prevent that these tests will be run
along with the tests of your project, the module is placed in an outside folder.