This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Diagnostics; | |
| // Set your own execution time here. | |
| using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); | |
| // dotnet add package RangeExtensions | |
| // Feel free to spawn an arbitrary (within reason) count of workers to simulate desired concurrency. | |
| // Keep in mind that HttpClient might reuse HttpMessageHandler's, feel free to tune to your taste. | |
| var workers = (..64) // ..Environment.ProcessorCount is also a good idea for simpler cases. | |
| .AsEnumerable() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Cysharp.Collections; // dotnet add package NativeMemoryArray | |
| namespace BufferAllocExample; | |
| public static class ExampleBufferedBytesProcessor | |
| { | |
| public static int ProcessBytes(IUtf8Processor processor, ReadOnlySpan<char> source, Span<byte> destination) | |
| { | |
| const int StackAllocLimit = 1024; // 1KB | |
| const int ArrayPoolLimit = 1024 * 1024 * 10; // 10MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Runtime.InteropServices; | |
| var writeable = MemoryMarshal | |
| .AsMemory(false.ToString().AsMemory()) | |
| .Span; | |
| "True\0".CopyTo(writeable); | |
| Console.WriteLine((object)false); // Prints 'True' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dotnet publish -c release -f net7.0 -r {RID} -p:PublishSingleFile=true --self-contained true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class AsyncEnumerableExtensions | |
| { | |
| /// <summary> | |
| /// Will skip faulted tasks by default | |
| /// </summary> | |
| public static async IAsyncEnumerable<TResult?> ParallelSelectAsync<T, TResult>( | |
| this IEnumerable<T> items, | |
| Func<T, Task<TResult>> operation, | |
| int parallelism = -1, | |
| bool throwOnError = false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List distributed by iblocklist.com | |
| China:1.0.1.0-1.0.1.255 | |
| China:1.0.2.0-1.0.3.255 | |
| China:1.0.8.0-1.0.15.255 | |
| China:1.0.32.0-1.0.63.255 | |
| China:1.1.0.0-1.1.0.255 | |
| China:1.1.2.0-1.1.3.255 | |
| China:1.1.4.0-1.1.7.255 | |
| China:1.1.8.0-1.1.8.255 |
NewerOlder