This file contains 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
// License: WTFPL | |
// Author: Orlys | |
// Year: 2024 | |
namespace System.Text.Json; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Dynamic; | |
using System.Text.Json; | |
public class DynamicJsonElement : DynamicObject |
This file contains 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 Microsoft.AspNetCore.Http; | |
using System.Threading.Tasks; | |
public class OnlineUserCounterMiddleware | |
{ | |
private RequestDelegate _next; | |
private static int s_onlineUserCount; | |
public OnlineUserCounterMiddleware( | |
RequestDelegate next) |
This file contains 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 SmtpServer.ComponentModel; | |
using SmtpServer; | |
using MimeKit; | |
using MailKit.Net.Smtp; | |
using SmtpServer.Storage; | |
using System.Buffers; | |
// **PREREQUIRED: ADD '127.0.0.1 aaa.bbb' to HOSTS file. |
This file contains 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
sudo apt-get remove software-center && sudo snap remove snap-store && sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y install docker docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin net-tools dnsutils && sudo snap install --classic dotnet-sdk && sudo snap install mqttx && sudo snap install postman && sudo snap install redisinsight && sudo snap install beekeeper-studio && sudo snap install --classic go && sudo snap install --classic codium && codium --force --install-extension Gruntfuggly.todo-tree && codium --force --install-extension hediet.vscode-drawio && codium --force --install-extension mhutchie.git-graph && codium --force --install-extension ms-azuretools.vscode-docker && codium --force --install-extension ms-vscode.makefile-tools && codium --force --install-extension waderyan.gitblame && codium --force --install-extension zaaack.markdown-editor && codium --force --install-extension hashicorp.terraform && codium --force --install-extension muhammad-samm |
This file contains 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
// MIT License | |
// | |
// Copyright © 2023 Orlys (Orlys Ma) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains 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
// | |
// Copyright 2022 Orlys Ma | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), | |
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
This file contains 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
// Copyright 2022 Orlys Ma | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O |
This file contains 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 EntityFrameworkHelper | |
{ | |
private static readonly System.Reflection.ConstructorInfo s_constructor = | |
typeof(System.Data.Entity.Infrastructure.UnintentionalCodeFirstException).GetConstructor(System.Type.EmptyTypes); | |
private static readonly System.Collections.Concurrent.ConcurrentDictionary<System.Type, bool> s_caches = | |
new System.Collections.Concurrent.ConcurrentDictionary<System.Type, bool>(); | |
public static bool IsDatabaseFirst<TDbContext>() where TDbContext : System.Data.Entity.DbContext |
This file contains 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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains 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 interface IIndexedEnumerator<T> : IEnumerator<T> | |
{ | |
int Index | |
{ | |
get; | |
} | |
bool IsOdd | |
{ |
NewerOlder