Skip to content

Instantly share code, notes, and snippets.

View soyprofesor's full-sized avatar

Shokhzod Azamatov soyprofesor

View GitHub Profile
Visual Studio 2026 18.x
Professional: NVTDK-QB8J9-M28GR-92BPC-BTHXK
Enterprise: VYGRN-WPR22-HG4X3-692BF-QGT2V
Product Year Version Product Keys
Visual Studio 2022 2021 17.x
Professional: TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
Enterprise: VHF9H-NXBBB-638P6-6JHCY-88JWH
Visual Studio 2019 2019 16.x
@soyprofesor
soyprofesor / ProcessStartInfo1.txt
Last active April 23, 2024 11:04
cmd read and write
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
// Create a new ProcessStartInfo
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe"; // Specify the command to run (in this case, cmd.exe)
@soyprofesor
soyprofesor / IDistributedCache.GetOrCreateAsync.cs
Created April 16, 2024 04:30 — forked from wahidustoz/IDistributedCache.GetOrCreateAsync.cs
IDistributedCache GetOrCreateAsync extension method.
public static class DistributedCacheExtensions
{
public static async Task<T?> GetOrCreateAsync<T>(
this IDistributedCache cache,
string key,
Func<DistributedCacheEntryOptions, Task<T>> factory,
CancellationToken cancellationToken = default)
{
var value = await cache.GetStringAsync(key, cancellationToken);
if(string.IsNullOrWhiteSpace(value))
@soyprofesor
soyprofesor / WinFormExceptionsHandler.cs
Created December 26, 2023 04:34 — forked from lkaczanowski/WinFormExceptionsHandler.cs
Global exception handler for windows forms
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
@soyprofesor
soyprofesor / connect-pop3-http.cs
Created November 28, 2023 15:00 — forked from aspose-com-gists/connect-pop3-http.cs
Connect to POP3 in C#
// Create an instance of the Pop3Client class
Pop3Client client = new Pop3Client("pop.domain.com", "username", "password");
// Create and configure HttpProxy
HttpProxy proxy = new HttpProxy("18.222.124.59", 8080);
client.Proxy = proxy;
// Get mailbox information
Pop3MailboxInfo mailboxInfo = client.GetMailboxInfo();

SignalR notification sample

  1. Create WebApi
  2. Install Microsoft.AspNetCore.SignalR.Client package
  3. Create custom Hub class inherited from Hub
    public class NotificationHub : Hub
    {
       public async Task SendMessage(string message)

{