Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

17 total results found

Programming

Code Snippets

Authentik NPM Redirect with Websocket support

Code Snippets

# Increase buffer size for large headers # This is needed only if you get 'upstream sent too big header while reading response # header from upstream' error when trying to access an application protected by goauthentik proxy_buffers 8 16k; proxy_buffer_s...

authentik
NPM
nginx
homelab

Left outer join

Code Snippets

from leftTable in context.leftTable join rightTable in context.rightTable on leftTable.FKRightTable equals rightTable.Id into rightTableJoin from joinedRightTable in rightTableJoin.DefaultIfEmpty() select new { LeftData = leftTable.data, RightData = joine...

C#
SQL
LINQ

List iteration using span

Code Snippets

var list = new List<int>(); foreach(var item in CollectionsMarshal.AsSpan(list)) { } Only usable if the collection is not changed during iteration (read only)

C#
Span
Collections

Async Parallel

Code Snippets

static Task ParallelForEachAsync<T> (IEnumerable<T> source, int degreeofParallelization, Func<T, Task> body) { async Task AwaitPartition(IEnumerator<T> partition) {...

C#
Async
Collections

Batching with LINQ

Code Snippets

static IEnumerable<IEnumerable<T>> Batch<T>(this IEnumerable<T> source, int batchSize) { return source.Select((item, inx) => new { item, inx }) .GroupBy(x => x.inx / batchSize) .Select(g => g.Select(x => x.item)); } https://stackoverfl...

AsyncHelper

Code Snippets

public static class AsyncHelper { private static readonly TaskFactory _myTaskFactory = new TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuat...

C#
Async

Optional<T>

Code Snippets

See Attachments

Docker Buildx Multi-Arch

Code Snippets

sudo docker buildx create --use --name multi-arch-builder Usage: sudo docker buildx build --platform=linux/arm64 -t tag:latest -f ./DockerTest/Dockerfile --load --no-cache . DockerFile: #See https://aka.ms/customizecontainer to learn how to customize your ...

docker
multi-arch
arm

Load Assembly Dynamically

Code Snippets

In order to Copy NuGet dependecies to the output folder add this to classlibrary.csproj: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> Set the Output directory with <BaseOutputPath>$(SolutionDir)AppName\bin</BaseOutputPath> To load Assemb...

C#

RegEx in multiple files multi-line pattern

Code Snippets

pcregrep -h -r --include=".*\.cs" -M "LogEvent\([\s\S]*?\)\;" . -h: Exclude filenames -r: recursive --include: include file names that matches with the pattern -M: multi-line mode PATTERN: match all occurrence even if it is multi-line Example: await ...

RegEx
Linux

Mount host volumes in WSL2

Code Snippets

Add the following to /etc/wsl.conf [automount] options = "metadata"

docker
wsl

Build project with SourceGenerator on linux

Code Snippets

Add Microsoft.Net.Compilers.Toolset package to the project that references the source generator.

C#
docker
Linux

Change file encoding with linux

Code Snippets

To get current encoding: file -i {filename} To convert it: iconv -f {sourceEncoding} -t {targetEncoding} {filename} Example: iconv -f ISO_8859-1 -t UTF-8 filename.txt  

Linux
wsl

Handle Exceptions with Task.WhenAll()

Code Snippets

var tasks = Enumerable.Range(0, 10).Select(async _ => await Task.Delay(1000)); var whenAll = Task.WhenAll(tasks); try { await whenAll; } catch {} if (whenAll.Exception is AggregateException ex) { //Handle Exception } https://www.youtube.com/...

macOS Defaults

Code Snippets

Auto-Resize Columns in column view defaults write com.apple.finder _FXEnableColumnAutoSizing -bool YES && killall Finder Scroll to Exposé app defaults write com.apple.dock "scroll-to-open" -bool "true" && killall Dock Make Dock icons of hidden applicatio...

macOS