Advanced Search
Search Results
17 total results found
Programming
Code Snippets
Authentik NPM Redirect with Websocket support
# 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...
Left outer join
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...
List iteration using span
var list = new List<int>(); foreach(var item in CollectionsMarshal.AsSpan(list)) { } Only usable if the collection is not changed during iteration (read only)
Async Parallel
static Task ParallelForEachAsync<T> (IEnumerable<T> source, int degreeofParallelization, Func<T, Task> body) { async Task AwaitPartition(IEnumerator<T> partition) {...
Batching with LINQ
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
public static class AsyncHelper { private static readonly TaskFactory _myTaskFactory = new TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuat...
Optional<T>
See Attachments
Docker Buildx Multi-Arch
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 ...
Load Assembly Dynamically
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...
RegEx in multiple files multi-line pattern
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 ...
Mount host volumes in WSL2
Add the following to /etc/wsl.conf [automount] options = "metadata"
Build project with SourceGenerator on linux
Add Microsoft.Net.Compilers.Toolset package to the project that references the source generator.
Change file encoding with linux
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
Handle Exceptions with Task.WhenAll()
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
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...