Skip to content

Instantly share code, notes, and snippets.

View GeorgeTsiokos's full-sized avatar

George Tsiokos GeorgeTsiokos

View GitHub Profile
@clemensv
clemensv / jsonschemaconstraints.md
Created July 31, 2023 08:38
Resolving Competing, Paradoxical Validation/Code-Gen Constraints in JSON Schema

Resolving Paradoxical Constraints in JSON Schema

Introduction

JSON Schema is a versatile tool for defining the structure of JSON data and ensuring its validation. However, as powerful as it is, complex scenarios can sometimes lead to paradoxical constraints, especially when used in combination with code generation tools. In this article, we'll take an in-depth look at one such paradox that emerged while defining message structures for various protocols and discuss a practical solution.

The Problem Statement

Imagine a system where messages are passed using different protocols, such as AMQP, HTTP, MQTT, Kafka, and CloudEvents. Each protocol has a distinct message structure but shares certain common attributes. These shared attributes are consolidated in a base message definition, called definition in our JSON Schema.

@mtds
mtds / lvn.md
Last active April 18, 2024 07:27
Linux Virtual Networking

Virtual Networking on Linux

In the Linux Kernel, support for networking hardware and the methods to interact with these devices is standardized by the socket API:

                +----------------+
                |   Socket API   |
                +-------+--------+
                        |
User space              |
@ReubenBond
ReubenBond / TransactionExtensions.cs
Last active April 30, 2017 05:51
Taking part in Service Fabric transactions
using System;
using System.Collections.Concurrent;
using System.Fabric.Replication;
using System.Reflection;
using System.Reflection.Emit;
using Microsoft.ServiceFabric.Data;
internal static class TransactionExtensions
{
@sbedford
sbedford / DeployReports.ps1
Last active June 16, 2020 11:59
SSRS Deployment Automation Snippets
##################################################################
### The following parameters are provided by Octopus Deploy. ###
### Uncomment these with default values for testing. ###
#################################################################
#$SSRSReportServerUrl = "http://ssrs/reportserver/reportservice2005.asmx"
#$SSRSDynamicDataSourceCredentialsUsername = ""
#$SSRSDynamicDataSourceCredentialsPassword = ""
#$SSRSReportFolder = "Project Folder"
#$SSRSSharedDataSourcePath = "/Data Sources/dsShared"
@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
public static IObservable<T> Conflate<T>(this IObservable<T> source, TimeSpan minimumUpdatePeriod, IScheduler scheduler)
{
return Observable.Create<T>(observer =>
{
// indicate when the last update was published
var lastUpdateTime = DateTimeOffset.MinValue;
// indicate if an update is currently scheduled
var updateScheduled = new MultipleAssignmentDisposable();
// indicate if completion has been requested (we can't complete immediatly if an update is in flight)
var completionRequested = false;
@AArnott
AArnott / WaitHandlerAwaitable.cs
Created July 15, 2011 15:55
C# 5 Awaitable WaitHandle
public static class AwaitExtensions
{
/// <summary>
/// Provides await functionality for ordinary <see cref="WaitHandle"/>s.
/// </summary>
/// <param name="handle">The handle to wait on.</param>
/// <returns>The awaiter.</returns>
public static TaskAwaiter GetAwaiter(this WaitHandle handle)
{
Contract.Requires<ArgumentNullException>(handle != null);