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
void Main() | |
{ | |
const string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | |
GenerateUniqueString(8, chars.ToCharArray()).Dump(); | |
} | |
public static string GenerateUniqueString(int size, char[] chars) | |
{ | |
var data = new byte[4 * size]; | |
using var crypto = new RNGCryptoServiceProvider(); |
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
void Main() | |
{ | |
var lb = new Vector2(1.1f, 2.2f); | |
var rt = new Vector2(5.6f, 3.4f); | |
ToCeilAndFlooredBoundingBox(lb, rt); | |
} | |
public static (Vector2, Vector2) ToCeilAndFlooredBoundingBox(Vector2 lb, Vector2 rt) | |
{ |
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
WHERE "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" >nul 2>&1 && (for /f "usebackq tokens=2*" %%A in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" ^| findstr DisplayVersion`) do set VS_VERSION=%%A) || (set VS_VERSION=NOT FOUND) | |
echo Visual Studio version %VS_VERSION% |
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
for /f "usebackq tokens=3*" %%A in (`reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Docker Desktop" /V DisplayVersion`) do set DOCKER_DESKTOP_VERSION=%%A |
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.Collections.Generic; | |
namespace Sample | |
{ | |
public class Class | |
{ | |
public void M() | |
{ | |
var dic1 = new Dictionary<string, string>() | |
{ |
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
async Task Main() | |
{ | |
await using var hoge = new Hoge(); | |
} | |
public class Hoge : IAsyncDisposable | |
{ | |
public ValueTask DisposeAsync() | |
{ | |
Console.WriteLine("DisposeAsync in class"); |
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
void Main() | |
{ | |
(-5 % 3).Dump("-5 % 3"); // -2 | |
(5 % -3).Dump("5 % -3"); // 2 | |
} |
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
#!/bin/bash | |
for item in *.p12 | |
do | |
filename="${item%%.*}" | |
openssl pkcs12 -in "${item}" -nodes -nocerts -passin pass:"" | openssl rsa -out "${filename}-key.pem" | |
openssl pkcs12 -in "${item}" -nodes -nokeys -passin pass:"" | openssl x509 -out "${filename}-cert.pem" | |
done |
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
// https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAJboMLoN7LpGYZQAs6AsgBQCU+hxAvsi0smpjOgEICmAOwDGACwC2AQwBOAa2QEkxdAAcpASwBuEgC590UvhOAB7AQBsAnujUDtAbQC66APoSA3MkZFO/YeOkydF4MikrErugAvOgCfADu1raO+OhwADToMBmoGWQZAKwZAGwZAOzoTB6hRGzBnDba6AAyggDm2iJB1SFhxFpS6BJRLu7BSmoAZujUEgB0LQLtIlHRcOgAZOtjvYPzbR0rmbTbRAo7YVDlcFXnbOeX6AAMN8ye3fW2zfsiTcbGyl0lGcdv1BsNXC9ehNjANqA1rMNngiADypNzWMBgWjA85ESbTOYLJaHNabE64wnfQ4wY7dc443FKB7XclKO47dm9B7PYJsNhAA=== | |
using System; | |
public class C { | |
public void M() { | |
} | |
} | |
public class Benchmark | |
{ | |
private readonly int[] _a; |
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
void Main() | |
{ | |
var summary = BenchmarkRunner.Run<BenchmarkSum>(); | |
} | |
[BenchmarkDotNet.Attributes.MemoryDiagnoser] | |
public class BenchmarkSum | |
{ | |
[Benchmark] | |
public void Slow() |