Skip to content

Instantly share code, notes, and snippets.

@iSeiryu
iSeiryu / csharp-post-example.md
Last active December 14, 2024 22:38
Simple get and post endpoints with C# vs NodeJS vs Rust

Program.cs

using System.Text.Json.Serialization;

var app = WebApplication.CreateBuilder(args).Build();

app.MapGet("/hi", () => "hi");
app.MapPost("send-money", (SendMoneyRequest request) =>
{
    var receipt = new Receipt($"{request.From.FirstName} {request.From.LastName}",
@jidckii
jidckii / alertmanager.tmpl
Created April 5, 2023 14:08
Alertmanager telegram template
{{ define "__yucca_text_alert_list" }}{{ range . }}
---
🪪 <b>{{ .Labels.alertname }}</b>
{{- if .Annotations.summary }}
📝 {{ .Annotations.summary }}{{ end }}
{{- if .Annotations.description }}
📖 {{ .Annotations.description }}{{ end }}
🏷 Labels:
{{ range .Labels.SortedPairs }} <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
{{ end }}{{ end }}
@MatrixManAtYrService
MatrixManAtYrService / Dockerfile
Last active March 4, 2025 15:34
tini vs dumb init
FROM ubuntu
RUN apt update
RUN apt install -y tini dumb-init python3-pip
RUN pip install apache-airflow
# place the entrypoint script
COPY entrypoint.sh /entrypoint
RUN chmod +x /entrypoint
# a script that calls airflow (and does test-relevant things too)
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active April 17, 2025 02:44
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/rfc9562/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@rafaelldi
rafaelldi / WinDbg and LLDB commands.md
Last active July 2, 2024 23:10
WinDbg and LLDB commands

Starting

Command WinDbg LLDB
Start windbg {executable} [{args}] lldb {executable} [--args]
Attach windbg -p {pid} lldb --attach-pid {pid}

Symbols and modules

Command WinDbg LLDB
(Re)load symbols lb {module-name} target symbols add {symbol-file-path}
@wosc
wosc / README.md
Created July 8, 2021 07:49
Creating tracing data from an haproxy access log via fluent bit and opentelemetry collector

Creating opentelemetry tracing data from an haproxy access log

Approach

Unfortunately, otelcol currently has no receiver for logfiles that produces tracing data. There is log tailing functionality, and e.g. a fluent forward protocol receiver, but they all create "log" data, not tracing. I've seen this proof of concept to implement a forward receiver that creates tracing data, but that seems to have no traction and no relation to the upstream project at all (not even git history.

Thus, we've settled on this approach:

@rafaelldi
rafaelldi / Monitoring TCP & UDP connections.md
Last active January 27, 2025 20:32
Monitoring TCP & UDP connections

Checking Windows network configuration

Command Alternative Description
Get-NetIPConfiguration ipconfig -all displays the IP network configuration
Get-NetAdapter shows various network adapter properties
Get-NetRoute netstat -r prints the IP routing table
Get-NetTCPSetting gets system TCP settings
Get-NetUDPSetting gets system UDP settings
Get-NetFirewallRule lists firewall rulles
@carolynvs
carolynvs / .gitconfig
Last active October 19, 2022 14:44
git wip - Show what branches you have been working on lately
[alias]
wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads
@rawc0der
rawc0der / crd2jsonschema.sh
Last active September 18, 2024 14:42
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Logging.StructuredLogger;
var build = BinaryLog.ReadBuild(@"p:\roslyn3\artifacts\log\Debug\Build.binlog");
var root = @"p:\roslyn3";
var sourceFileSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
build.VisitAllChildren<CscTask>(cscTask =>