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
CREATE FUNCTION [dbo].[GenerateULID] | |
( | |
@random AS BINARY(10), | |
@timestamp AS DATETIME2 = NULL | |
) | |
RETURNS VARCHAR(26) | |
AS | |
BEGIN | |
-- Crockford's base32 alphabet | |
DECLARE @alphabet VARCHAR(32) = '0123456789ABCDEFGHJKMNPQRSTVWXYZ' |
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
DECLARE @name NVARCHAR(256) | |
DECLARE @path NVARCHAR(512) | |
DECLARE @fileName NVARCHAR(512) | |
DECLARE @fileDate NVARCHAR(40) | |
-- specify database backup directory | |
SET @path = 'D:\Backup\Database\' | |
-- specify filename format | |
SELECT @fileDate = CONVERT(NVARCHAR(20),GETDATE(),112) |
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
([\w._]+)\.Should\(\)\.NotBeNull\(\) | |
Assert.NotNull($1) | |
([\w._]+)\.Should\(\)\.NotBeEmpty\(\) | |
Assert.NotEmpty($1) | |
([\w.!_]+)\.Should\(\)\.Be\(([\w.!_" ]+)\) | |
Assert.Equal($2, $1) | |
([\w._]+)\.Should\(\)\.BeTrue\(\) |
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
[MemoryDiagnoser] | |
public class BenchmarkSwitch | |
{ | |
[Params(typeof(int), typeof(DateTimeOffset), typeof(TimeSpan))] | |
public Type TargetType { get; set; } = typeof(int); | |
[Benchmark(Baseline = true)] | |
public int BaseLineBenchmark() | |
{ | |
if (TargetType == typeof(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
public readonly struct ConcurrencyToken : IEquatable<ConcurrencyToken> | |
{ | |
public static readonly ConcurrencyToken None = new(Array.Empty<byte>()); | |
public byte[] Value { get; } | |
public ConcurrencyToken(byte[] value) | |
{ | |
Value = value ?? Array.Empty<byte>(); | |
} |
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 Program | |
{ | |
public static int Main(string[] args) | |
{ | |
// azure home directory | |
var homeDirectory = Environment.GetEnvironmentVariable("HOME") ?? "."; | |
Log.Logger = new LoggerConfiguration() | |
.MinimumLevel.Verbose() | |
.MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
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.Text; | |
using System.Text.Json; | |
using Microsoft.AspNetCore.Mvc.Infrastructure; | |
namespace Demo.Middleware; | |
public class HostDebuggerOptions | |
{ | |
public string RouteDebuggerPath { get; set; } = "/route-debugger"; |
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
apk add --no-cache python3 py3-pip | |
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | |
chmod +x speedtest-cli | |
python3 speedtest-cli |
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
trigger: | |
- main | |
- develop | |
- releases/* | |
variables: | |
major: 1 | |
minor: 0 | |
name: $(major).$(minor).$(Rev:r) |
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 AssemblyMetadata | |
{ | |
private static readonly Lazy<string> _fileVersion = new(() => | |
{ | |
var assembly = typeof(AssemblyMetadata).Assembly; | |
var attribute = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>(); | |
return attribute?.Version; | |
}); | |
private static readonly Lazy<string> _assemblyVersion = new(() => |
NewerOlder