Skip to content

Instantly share code, notes, and snippets.

View peteraritchie's full-sized avatar
😖

Peter Ritchie peteraritchie

😖
View GitHub Profile

az devops invoke Areas - Slim

area resourceName routeTemplate
acs WRAPv0.9 {resource}
AdminEngagement Organization _apis/{area}/{resource}/{action}
advSec Enablement _apis/{area}/{resource}
advSec billableCommitters {project}/_apis/{area}/{resource}
advSec EstimateProject {project}/_apis/{area}/Estimate
advSec EstimateRepo {project}/_apis/{area}/repositories/{repositoryId}/Estimate

az devops invoke Areas

area id maxVersion minVersion releasedVersion resourceName resourceVersion routeTemplate
acs 8b1e4204-96e8-41c2-81ca-5cad5cd5ef25 7.20 0.00 7.1 WRAPv0.9 1 {resource}
AdminEngagement bec0e728-8f67-4ee3-81e8-9f475d184e45 5.10 1.00 0.0 Organization 1 _apis/{area}/{resource}/{action}
advSec 3aa66234-9ab4-4ff9-9d5a-09b7ac9133b1 7.20 7.10 0.0 Enablement 1 _apis/{area}/{resource}
advSec f890a08b-1e12-4f1a-be3f-31a8b361b24e 7.20 7.10 0.0 billableCommitters 1 {project}/_apis/{area}/{resource}
advSec bffb42ee-3cb6-450c-9d11-70797507c7d7 7.20 7.20 0.0 EstimateProject 1 {project}/_apis/{area}/Estimate
advSec 99e4aa9e-93dd-4f07-a70b-928b37aedde0 7.20 7.20 0.0 EstimateRepo 1 {project}/_apis/{area}/repositories/{repositoryId}/Estimate
@peteraritchie
peteraritchie / delete-merged-branches.md
Created January 23, 2025 14:12
Delete git branches merged to main

Delete git branches merged to main

A simple powershell script to clean up local branches that have been merged to main:

git branch --merged main | Foreach-object { if($_.SubString(0,1) -ne '*'){ git branch -d $_.SubString(2);} }
@peteraritchie
peteraritchie / TrySingleExtensionMethod.cs
Created January 9, 2025 18:12
An extension method that uses the Try pattern to get a single value from a collection.
public static class Extensions
{
/// <summary>
/// Try to get the single value from the collection
/// </summary>
/// <typeparam name="T">The type of elements in the collection</typeparam>
/// <param name="source">the source collection</param>
/// <param name="predicate">The predicate to test elements</param>
/// <param name="item">The item found, or null</param>
/// <returns>true if found, false otherwise</returns>
@peteraritchie
peteraritchie / nullable-reference-type-tryget.md
Last active December 17, 2024 22:09
Thoughts on a method to get the value of a nullable reference type without the out value itself be nullable.

public static class X { /// Easy with structs</remarks public static bool TryGetValue(this T? nullable, ref T value) where T : struct { if (nullable.HasValue) { value = nullable.Value; return true; }

/// <summary>
/// Some extensions for <seealso cref="ImmutableList{T}"/>
/// </summary>
public static class ImmutableListExtensions
{
/// <summary>
/// Replace <paramref name="value"/> in <paramref name="source"/> based on object equality
/// </summary>
/// <remarks>
/// This method depends on the <typeparamref name="T"/> implementing Object.Equals, if it does not,
@peteraritchie
peteraritchie / sync-all-the-forks.bat
Created April 28, 2022 19:56
Sync (fetch upstream, `fetch` and `merge`) all accessible GitHub forks via GitHub CLI
for /f %%A in ('gh repo list --fork -L 1000 --json nameWithOwner -q ".[].nameWithOwner"') do gh repo sync %%A

The structure of IPv4 addresses lies at the core of the internet's architecture

  • does calling out IPv4 mean many of the details in this chapter apply to IPv6?

The very structure of IPv4 addresses presents an interesting duality: they serve as both identifiers and locators.

  • "Locator" in what sense?

[Just as a street address indicates a specific location, an IP address designates a particular device on a network. The subnet mask, analogous to the zip code, guides data packets to their intended destination.](https://cwoodruff.github.io/book-network-programming-csharp/chapter02/#:~:text=just%20as%20

HTML Entities

general

HTML Description HTML Description HTML Description
&incare; care of &rx; prescription &target; target
&hybull; hypen bullet &olcir; circled white bullet &ofcir; ⦿ circled bullet
&hairsp; very thin space &ZeroWidthSpace; zero-width space

Arrows

@peteraritchie
peteraritchie / Directory.build.props
Last active February 27, 2024 20:11
A Directory.build.props file that cleans the `obj` and `bin` directories when executing `dotnet clean` or the clean operation in Visual Studio. Find latest version here: https://gist.githubusercontent.com/peteraritchie/c32008d0c20323126c908a61ef9991d6/raw/Directory.build.props
<Project>
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
<PropertyGroup>
</PropertyGroup>
<Target Name="PostClean" AfterTargets="Clean">
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
<RemoveDir Directories="$(BaseOutputPath)" />
</Target>
</Project>