Skip to content

Instantly share code, notes, and snippets.

@Ilchert
Ilchert / HttpClinetConfig.cs
Created March 18, 2025 17:23
HttpClinetConfig
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpClient();
builder.Services.AddSingleton<ICertificateProvider, CertificateProvider>();
builder.Services.AddSingleton<IPostConfigureOptions<HttpClientFactoryOptions>, ConfigureHttpClientFactory>();
var app = builder.Build();
var factory = app.Services.GetRequiredService<IHttpClientFactory>();
app.MapGet("/{clientId}", async (string clientId) =>
1. Create c:\1.restore.json
2. msbuild c:\1.csproj -target:GenerateRestoreGraphFile -property:RestoreGraphOutputPath="c:\1.restore.json" -property:RestoreRecursive=false -property:RestoreDotnetCliToolReferences=false
3. dotnet nuget package add --package Litedb c:\\1.csproj --dg-file c:\1.restore.json
using System;
using System.Collections.Generic;
using System.Linq;
// define BowlingGame Class in a new file
// define Frame Class in a new file
class MainClass
{
static void Main()
static class RSAParametersHelper
{
public static RSAParameters FromPem(string pem)
{
using var rsa = new RsaPem();
rsa.ImportFromPem(pem);
return rsa.ExportParameters();
}
class RsaPem : RSA
public class Container
{
private SortedDictionary<int, int> _storage = new();
private int _count = 0;
public Container()
{
// write your code here
}
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
public class Programm
{
static int _idCounter = 0;
interface IService
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
var services = new ServiceCollection();
services.AddSingleton<RootService>();
services.AddSingleton<IService, RootService>();
PluginImplementation.Configure(services);
using var rootSp = services.BuildServiceProvider();
var pluginRegistration = rootSp.GetRequiredService<IOptionsMonitor<PluginRegistration>>()
//solution2("...xxx..x....xxx.", 7);
//solution("aaAbcCABBc");
static int solution2(string S, int B)
{
if (B < 2 || S.Length == 0)
return 0;
var potholes = new List<int>();
var count = 1;
@Ilchert
Ilchert / U8File.cs
Last active January 11, 2024 01:39
using System.Buffers;
using System.IO.Pipelines;
using System.Runtime.CompilerServices;
using U8;
using U8.InteropServices;
namespace _1brc
{
internal class U8File
{
// See https://aka.ms/new-console-template for more information
using System.Buffers;
using System.Buffers.Binary;
using System.Buffers.Text;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Threading.Channels;
var filePath = @"C:\projects\local\1brc-main\measurements.txt";