Skip to content

Instantly share code, notes, and snippets.

View devops-school's full-sized avatar

DevOps School devops-school

View GitHub Profile
@devops-school
devops-school / AllocationBenchmarks.cs
Created November 27, 2025 06:14
BenchmarkDotNet: DOTNET Lab & Demo
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using System;
using System.Text;
namespace BenchmarkDotNetLab
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
@devops-school
devops-school / AllocationBenchmarks.cs
Created November 27, 2025 06:13
BenchmarkDotNet: DOTNET Lab & Demo
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using System;
using System.Text;
namespace BenchmarkDotNetLab
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
@devops-school
devops-school / ComplexityBenchmarks.cs
Created November 27, 2025 06:12
BenchmarkDotNet: DOTNET Lab & Demo
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using System;
using System.Linq;
namespace BenchmarkDotNetLab
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
@devops-school
devops-school / AlgoBenchmarks.cs
Created November 27, 2025 06:11
BenchmarkDotNet: DOTNET Lab & Demo
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using System;
using System.Linq;
namespace BenchmarkDotNetLab
{
// Captures allocations & GC info
[MemoryDiagnoser]
// Rank methods from fastest to slowest
@devops-school
devops-school / Program.cs
Created November 26, 2025 07:56
DOTNET: Threading Design Example threading anti-patternsm, proper async/await & concurrency behavior
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
// Minimal API demo to show bad vs good threading practices in .NET
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Simple concurrency metrics
@devops-school
devops-school / Program.cs
Created November 26, 2025 07:15
DOTNET: Understanding Garbage Collection with Gen0, Gen1, Gen2
using System;
using System.Collections.Generic;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("=========================================");
Console.WriteLine(" .NET GC Generations Demo (Gen0/1/2) ");
@devops-school
devops-school / Program.cs
Created November 26, 2025 06:52
DOTNET: Understanding Memory leaks and Debugging using dotMemory
using System.Diagnostics;
using System.Text;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// ===============================================
// INTENTIONAL MEMORY LEAK DEMO
// ===============================================
//
@devops-school
devops-school / Program.cs
Created November 26, 2025 06:30
DOTNET: TLS & Its Versions impact on Performance
using System.Diagnostics;
using System.Net;
using System.Security.Authentication;
using System.Threading;
// Simple .NET minimal API to demo TLS 1.2 vs TLS 1.3 impact
// and expose basic in-process metrics at /metrics
var builder = WebApplication.CreateBuilder(args);
@devops-school
devops-school / CircularDependencyDemo.cs
Last active November 26, 2025 05:50
Circular Dependency in DOT NET
// ============================================================
// Circular Dependency Example (BAD) + Fixed Example (GOOD)
// Single-file demonstration for training
// ============================================================
using System;
using Microsoft.Extensions.DependencyInjection;
namespace CircularDependencyDemo
{
@devops-school
devops-school / mail.php
Created November 24, 2025 13:35
PHP Code for Godaddy VPS Server SMTP Email Relay
<?php
$host = 'n1smtpout.europe.secureserver.net';
$port = 25;
$from = 'contact@guestpostai.com';
$to = 'contact@guestpostai.com';
echo "<pre>Connecting to SMTP ($host:$port)...\n";