Skip to content

Instantly share code, notes, and snippets.

View clemensv's full-sized avatar
🏠
Working from home

Clemens Vasters clemensv

🏠
Working from home
View GitHub Profile
@clemensv
clemensv / plainjson.md
Last active May 3, 2024 06:41
"Plain JSON" encoding for Apache Avro
@clemensv
clemensv / CloudEvents with ASA
Created September 13, 2023 10:18
Using CNCF CloudEvents with ASA
I wrote the code, ChatGPT the text. I'll eventually write an actual article, but this will do:
### Consuming and Creating (Structured, JSON) CloudEvents in Azure Stream Analytics
Hey devs, today we're going to talk about working with structured JSON CloudEvents in Azure Stream Analytics. We'll be using some straightforward SQL-like queries to get this done, and I promise to keep the jargon to a minimum. Let's get started.
#### Setting Up Your Event Stream
We assume that the input is an Event Hub that multiplexes CloudEvents in structured JSON format.
@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.

Erstelle eine neue Auto-Rundtour von 200km mit Startpunkt in Viersen mit dem Thema Wasserschlösser.
Ermittle die Strassenadressen für jeden Wegpunkt. Gebe das Ergebnis als GPX XML Text aus, eingeschlossen von ```. Benutze Routenpunkte.
Alle Erklärungen sollten in den Beschreibungselementen der Datei enthalten sein:
In <name> benutze das Format {zielname}; {strasse} {hausnummer}; {postleitzahl} {ort}.
Benutze eine aussagekräftige Beschreibung in <desc>.
Gib die Zusammenfassung der Route in <metadata> aus.
Antworte NUR mit dem XML Text. Achte auf die korrekten XML Namespaces.
@clemensv
clemensv / jsonSchema.jinja
Created January 9, 2023 08:32
GPT wrote this
{%- set schema_name = "MySchema" | pascal -%}
{%- set list_type = "List" %}
namespace {{ schema_name }}
{
static class ExceptionMessages
{
public static readonly string ValueIsTooLow = "{0} value is too low. (min: {1})";
public static readonly string ValueIsTooHigh = "{0} value is too high. (max: {1})";
public static readonly string ValueIsTooLong = "{0} value is too long. (max length: {1})";
public static readonly string ValueIsTooShort = "{0} value is too short. (min length: {1})";
Create a markdown string that is a fawning review of the Porsche Taycan 4S, complete with Wikipedia links and a headline.
Don't show the string. Don't provide explanations.
Show me how to echo (using -e option) the string into a text.md file in the current directory. Replace line breaks with \n
@clemensv
clemensv / gist:7489010b044589d757a96237262c529a
Created December 11, 2022 14:28
ChatGPT code-gen prompt
Try this:
First prompt:
=========================
Create a Python script. The script takes a prompt from the command line and creates text using OpenAI's GPT-3 API.
Write no explanations or step-by-step instructions. Do not tell me what to do. Do not show the files. Write no headlines. Verify that the script meets all requirements. Just tell me if you understood all requirements and have created the files.
The following requirements must be met for the script:
{
"self": {
"usage": "subscriber",
"config": {
"protocol": "HTTP",
"strict": false,
"endpoints": [
"http://localhost:11000/subscriptions"
]
},
openapi: "3.1.0"
info:
title: CloudEvents discovery API
description: CloudEvents discovery API specification according to [Discovery - Version 0.1-wip](https://github.com/cloudevents/spec/blob/main/discovery/spec.md#endpoint).
version: "0.1-WIP"
servers:
- url: https://api.cloudevents.io/test/v0.1
paths:
/endpoints:
get:
@clemensv
clemensv / client.yml
Created September 22, 2022 09:14
Multiplexed RDP azbridge config
# Azure Relay Bridge Configuration - Client-Side
LocalForward :
- RelayName: mylab
ConnectionString: <<connection string>>
Bindings:
- BindAddress: 127.1.0.2
BindPort: 13389
PortName: rdp1
- BindAddress: 127.1.0.3