Skip to content

Instantly share code, notes, and snippets.

View CSTDev's full-sized avatar

Carl Taylor CSTDev

View GitHub Profile
@CSTDev
CSTDev / diagram_generator.py
Last active June 30, 2026 07:56
Creates a draw.io style diagram for a data flow modelled in yaml.
#!/usr/bin/env python3
"""Generate a .drawio diagram from a flow definition plus its registry.
Reads the Git-native registry layout described in work/Data flow design.md
(registry/components, registry/edges, registry/flowsone YAML file per
ID) and emits a draw.io (mxGraph) XML file for a single flow: one vertex
per component occurrence in the path, one edge per path step labelled with
transport/format.
Annotations render in two distinct ways depending on where they're
@CSTDev
CSTDev / MetricsMiddleware.cs
Last active October 2, 2019 09:37
.Net core middleware for Prometheus metrics on all HTTP requests
using Microsoft.AspNetCore.Http;
using Prometheus;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace mynamespace
{
/// <summary>
/// Middleware component to add a histogram and gague for each HTTP request API endpoint
/// </summary>
@CSTDev
CSTDev / Jenkinsfile
Last active May 21, 2025 06:31
Monorepo Jenkinsfile and groovy script that will create a Multi-branch pipeline for each project that has a Jenkinsfile within your repository, put at the top level of your repo and create a job in Jenkins that runs the Jenkinsfile. Useful for when you're using a monorepo and have multiple Jenkinsfiles in multiple sub directories. This can still…
pipeline {
agent {
label 'docker'
}
stages{
stage('Create jobs'){
steps{
container('docker'){
script{
@CSTDev
CSTDev / auto-increment-version.sh
Last active June 28, 2025 07:37
Script that will find the last Git Tag and increment it. It will only increment when the latest commit does not already have a tag. By default it increments the patch number, you can tell it to change the major or minor versions by adding #major or #minor to the commit message.
#!/bin/bash
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
#get number parts and increase last one by 1
VNUM1=${VERSION_BITS[0]}