Skip to content

Instantly share code, notes, and snippets.

using ScottPlot;
using System;
using System.Collections.Generic;
using System.Linq;
var plt = new Plot(600, 400); // Fixed width, initial height
// Example data for bars
List<DateTime> startTimes = new List<DateTime>() { /* populate with start times */ };
List<DateTime> endTimes = new List<DateTime>() { /* populate with end times */ };
using System;
using System.Collections.Generic;
using ScottPlot;
public class ConcurrencyPlotter<TLog> where TLog : LogEntry
{
private readonly List<TConcurrency<TLog>> _concurrencyTimeline;
public ConcurrencyPlotter(List<TConcurrency<TLog>> concurrencyTimeline)
{
@recalde
recalde / ConcurrencyTracker.cs
Created November 12, 2024 02:19
ConcurrencyTracker<TLog>
using System;
using System.Collections.Generic;
using System.Linq;
public class LogEntry
{
public DateTime Timestamp { get; set; }
public TimeSpan Duration { get; set; }
public string Host { get; set; }
}
using Microsoft.AspNetCore.Mvc;
using SkiaSharp;
[Route("api/status/badge")]
[ApiController]
public class StatusBadgeController : ControllerBase
{
[HttpGet]
public IActionResult GetStatusBadge()
{
@recalde
recalde / DirectoryFileMerger.cs
Created November 9, 2024 02:44
Merge logs by pod
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ParquetSharp;
public class DirectoryFileMerger
{
private readonly string _directoryPath;
private readonly string _outputFilePath;
@recalde
recalde / DirectoryFileMerger
Created November 9, 2024 02:34
Parquet DirectoryFileMerger
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ParquetSharp;
public class DirectoryFileMerger
{
private readonly string _directoryPath;
private readonly string _outputFilePath;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Timers;
using ParquetSharp;
public class LogAggregator<TLog> : IDisposable where TLog : class
{
private readonly List<TLog> _records = new();
@recalde
recalde / log_monitor.cs
Created September 26, 2024 14:46
log_monitor
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using k8s;
using k8s.Models;
using Npgsql;
@recalde
recalde / load_balancer.py
Created September 26, 2024 14:43
python_load_balancer
from fastapi import FastAPI, BackgroundTasks
from pydantic import BaseModel
import requests
import random
import time
import boto3
from boto3.dynamodb.conditions import Key
app = FastAPI()
@recalde
recalde / db_config.json
Created March 13, 2024 01:28
Export Data Script
{
"sql_server": {
"driver": "{SQL Server}",
"server": "your_server",
"database": "your_database",
"username": "your_username",
"password": "your_password"
},
"oracle": {
"dsn": "your_dsn",