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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reactive; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
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
Set-ExecutionPolicy Unrestricted -force | |
# fix Mouse scrolling | |
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 } | |
# Choco install | |
iex ((new-object net.webclient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
choco feature enable -n=allowGlobalConfirmation | |
choco install FiraCode | |
choco install GoogleChrome | |
choco install vscode |
Objective:
For Task<T>
and ValueTask<T>
(T
=int
as a common non-trivial but inlineable case), compare async performance in
the synchronous scenario (i.e. where data happens to be buffered - common in deserialization etc code) for 3 implementations:
- using
await
throughout - using synchronous code until incompleteness detected (via
IsCompleted
); switch via localasync Awaited
if needed - using synchronous code until incompleteness detected (via
IsCompletedSuccessfully
); switch via localasync Awaited
if needed
Note:
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
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
// Add this to your C# console app's Main method to give yourself | |
// a CancellationToken that is canceled when the user hits Ctrl+C. | |
var cts = new CancellationTokenSource(); | |
Console.CancelKeyPress += (s, e) => | |
{ | |
Console.WriteLine("Canceling..."); |
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
// by @noseratio | |
#nullable enable | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Noseratio.Experimental |
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
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<title>Redirecting to the Fediverse</title> | |
<head> | |
<script> | |
// let's say this is hosted at example.com. Given a url of one of the forms: | |
// - example.com/@[email protected]/post_id | |
// - example.com/@[email protected] | |
// - example.com/@instance.com | |
// redirect accordingly |
OlderNewer