Skip to content

Instantly share code, notes, and snippets.

View chrisfcarroll's full-sized avatar
🤹‍♂️
🌍...☕...🖥️...⏳...⛪...🛌🏼

Chris F Carroll chrisfcarroll

🤹‍♂️
🌍...☕...🖥️...⏳...⛪...🛌🏼
View GitHub Profile
@chrisfcarroll
chrisfcarroll / DevAzure tasks and GOTCHAS.yml
Last active October 11, 2024 16:57
DevAzure tasks and GOTCHAS
task: PowerShell@2
displayName: "Dev Azure tasks and GOTCHAS"
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
@"
DevAzure tasks and GOTCHAS: NuGet.config, MsBuild Path, Unit Tests, Integration Tests
"@
@chrisfcarroll
chrisfcarroll / DDictionary.cs
Created June 19, 2024 09:23
A C# DDictionary<K,V> is a Dictionary<K,V> which, if you try to read an empty entry, returns default(V) instead of throwing an exception.
using System.Collections.Generic;
/// <summary>
/// A <see cref="Dictionary{TKey,TValue}&lt;K,V>"/> which, if you try to read
/// an empty entry, returns default(V) instead of throwing an exception.
/// </summary>
/// <remarks>
/// If you cast a <see cref="DDictionary{K,V}"/> to a <see cref="Dictionary{TKey,TValue}"/>
/// then reading an empty entry will throw.
/// <code>
@chrisfcarroll
chrisfcarroll / strings.cs
Last active February 3, 2024 13:16
C# string.MaskStart(), .MaskEnd(), string.Chop() string.ToWikiWords(), PascalCaseToWords() string.WithWhiteSpaceRemoved() and similar
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.RegularExpressions;
public static class StringExtensions
{
/// <summary>Trim one occurrence of <paramref name="terminator"/> string from
/// the end of <paramref name="str"/>, if there is one.
@chrisfcarroll
chrisfcarroll / EFCoreAndDomainModels.cs
Last active November 7, 2023 12:39
Minimal EFCore Demo for Domain-Application-Infrastructure DDD structure
using System.Diagnostics;
using EFCoreAndDomainModels.Application;
using EFCoreAndDomainModels.Domain;
using EFCoreAndDomainModels.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using TestBase;
using Xunit.Abstractions;
namespace EFCoreAndDomainModels
@chrisfcarroll
chrisfcarroll / azcommandlineexamples.sh
Created January 28, 2023 16:42
Show some example az cli commands to create and delete a VM
#! /usr/bin/env sh
cat << 'EOF'
Get pricing:
location.href="https://prices.azure.com/api/retail/prices?$skip=0&currencyCode='GBP'&$filter=location eq 'UK South' and serviceName eq 'Virtual Machines' and priceType eq 'Consumption'"
Create Spot VM
az vm create -g VM --name VM --admin-username azureuser --image CentOS --generate-ssh-keys --public-ip-sku Standard --priority Spot --eviction-policy Delete
Destroy VM
@chrisfcarroll
chrisfcarroll / AzBlobStorageReader.cs
Last active January 29, 2023 19:23
Azure Blob Storage parallel downloads of 1000s files
//
// Dependency: dotnet add package Azure.Storage.Blobs
// #r "nuget:Azure.Storage.Blobs"
//
// Parallel download blobs from an Azure Blob Storage container, and report speed and bandwidth metrics
// As is, this code searches for blobs by index tag. To download by virtual folder instead,
// replace blobItems = containerClient.FindBlobsByTags(indexTagFilter) with
// blobItemsUntagged = containerClient.GetBlobs();
//
using System.Diagnostics;
# This is Git's per-user configuration file.
# [user]
[alias]
root = rev-parse --show-toplevel
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[merge]
tool = p4merge
[color]
ui = true
[color "status"]
@chrisfcarroll
chrisfcarroll / MacKeyboardOnPc.ahk
Last active September 5, 2024 23:55
MacKeyboardOnPc Minimal.ahk
#Requires AutoHotkey v2.0
;
; AutoHotKey 2.0 typographic relief for Mac keyboard users on Windows, whether
;
; — plugging a Mac Keyboard into a PC
; — or just missing the extended typographic symbols that the Mac puts on the Alt keys.
;
; Set these Switches to true/false to match your preferences
;
;
@chrisfcarroll
chrisfcarroll / Microsoft.PowerShell_profile.ps1
Last active October 22, 2024 12:36
Common Aliases and Paths for PowerShell Profile Microsoft.PowerShell_profile.ps1: editors, paths, git, docker, dotNet, IIS
# https://gist.github.com/chrisfcarroll/f3ecb2892f996149ee039d48abb57101
# Aliases and Paths for PowerShell Profile ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
#
# ----------------------------------------------------
# For machines where you have no privileges you should be able to enable scripts for yourself only with:
#
# `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`
# ----------------------------------------------------
#
# Sections: Paths, Editors, Tab Completion, Git abbreviations, Docker abbreviations, other prefs, firstRun
#nullable enable
using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic;
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace LogAssert
{