Skip to content

Instantly share code, notes, and snippets.

View Aimeast's full-sized avatar
🙃
There is no typing

Aimeast

🙃
There is no typing
View GitHub Profile
@Aimeast
Aimeast / en.md
Last active February 22, 2025 11:30
A Comprehensive Analysis on Selecting the Best .NET Core SSH Server Library

A Comprehensive Analysis on Selecting the Best .NET Core SSH Server Library

In the realm of secure remote access, SSH (Secure Shell) servers are essential for enabling secure communication between clients and servers over potentially insecure networks. For developers working with .NET Core, selecting the right SSH server library is crucial to ensure compatibility, performance, and feature richness. This analysis explores the process of identifying and evaluating potential libraries, culminating in the recommendation of Rebex SSH Pack as the best option, while also considering alternatives like FxSsh and SSH.NET for context.

Understanding the Requirement

An SSH server library allows a .NET Core application to function as an SSH server, accepting connections from SSH clients for tasks such as command execution, file transfers via SFTP or SCP, and secure shell sessions. Given .NET Core’s cross-platform nature, the library must support modern versions like .NET 8, ensuring compatibility with Windows, m

@Aimeast
Aimeast / Program.cs
Created January 26, 2022 16:03
Add headers to PDF files with Spire.Pdf
using Spire.Pdf;
using Spire.Pdf.Graphics;
// Main call
static void AddHeader(PdfPageBase page, string left, string center, string right)
{
var state = page.Canvas.Save();
RotatePage(page);
AddHeaderWithRotatedPage(page, left, center, right);
page.Canvas.Restore(state);
@Aimeast
Aimeast / LimitedConcurrencyLevelTaskScheduler.cs
Created April 4, 2017 14:06
LimitedConcurrencyLevelTaskScheduler.cs
//--------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: LimitedConcurrencyTaskScheduler.cs
// Source: https://code.msdn.microsoft.com/vstudio/Execution-Time-Based-dd4dbdb6/sourcecode?fileId=67470&pathId=1378361369
// Modified for .net core
//--------------------------------------------------------------------------
using System;
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!
#region Socket operations
protected IAsyncResult BeginSocketRead(int length, ApmCallback callback)
{
return BeginSocketIO(new byte[length], callback, _socket.BeginReceive, _socket.EndReceive);
}
protected IAsyncResult BeginSocketWrite(byte[] data, ApmCallback callback)
{
return BeginSocketIO(data, callback, _socket.BeginSend, _socket.EndSend);
}
@Aimeast
Aimeast / RIR Delegations.md
Last active February 9, 2025 16:03
RIR Delegations

https://www-public.telecom-sudparis.eu/~maigron/rir-stats/

RIR Delegations

These pages provide statistics on IP addresses and ASN numbers delegated by RIRs to each country in their geographic area. Delegation details for each country are also available.

These statistics are generated automatically from the RIRs delegation files available via FTP:

@Aimeast
Aimeast / CancellationToken.cs
Last active August 29, 2015 14:03
Test CancellationToken
static void Main()
{
var source = new CancellationTokenSource();
var task1 = Task.Factory.StartNew(() =>
{
Console.WriteLine("run task1");
Task.Delay(2000).Wait();
Console.WriteLine("after delay task1");
source.Token.ThrowIfCancellationRequested();
Console.WriteLine("no exec task1");
@Aimeast
Aimeast / jQueryPlugin.js
Last active August 29, 2015 13:57
jQuery Plugins Working for GitCandy
/*
GitCandy is a Git platform based on ASP.NET MVC
Source on: http://github.com/Aimeast/GitCandy
Demo on: http://git.53wb.com/
The MIT License (MIT)
Copyright (c) 2014 Aimeast
*/
@Aimeast
Aimeast / Program.cs
Created February 16, 2014 15:35
Combine Highlight.js
// A highlight.js packer which work for Git Candy©
// The output please reference to https://github.com/Aimeast/GitCandy/blob/dev/GitCandy/Scripts/highlight.pack.js
class Program
{
static void Main(string[] args)
{
using (var writer = new StreamWriter("highlight.pack.js"))
{
writer.WriteLine("//https://github.com/isagalaev/highlight.js");
@Aimeast
Aimeast / Inlining.cs
Last active February 21, 2017 17:04
Test C# inlining method (framework 4.5)
/*
* Following code for test an method will be inlined by JIT or not
* Tested on Framework 4.5, Win8 x64
*
* http://blogs.msdn.com/b/ericgu/archive/2004/01/29/64717.aspx
* http://blogs.microsoft.co.il/blogs/sasha/archive/2012/01/20/aggressive-inlining-in-the-clr-4-5-jit.aspx
*/
using System;
using System.Diagnostics;