Skip to content

Instantly share code, notes, and snippets.

View bymyslf's full-sized avatar

Luís Barbosa bymyslf

View GitHub Profile
@bymyslf
bymyslf / notification-service-commands-and-mapper-contexts.md
Created August 23, 2026 17:15
Notification Service: Events, Commands, and Mapper Contexts

Notification Service: Events, Commands, and Mapper Contexts

The design problem

Suppose there is a generic Notification Service through which every notification is delivered.

There are two obvious ways to integrate it with the rest of the system, plus an evolutionary alternative based on mapper contexts.

The key question is not whether services may know about one another. Messages and APIs are contracts, so cross-boundary coupling is expected. The important question is where the business knowledge belongs.

@bymyslf
bymyslf / hdtc_protocol.md
Created August 19, 2026 08:24
The Hypermedia-Driven Tool Calling (HDTC) Protocol

The Hypermedia-Driven Tool Calling (HDTC) Protocol

It bridges the gap between raw API design and autonomous AI agency, providing a clear path for other developers to implement the same "Link-Schema Bridge" logic.

1. Introduction

The HDTC Protocol is a standardized method for enabling AI agents to interact with RESTful APIs dynamically. Unlike traditional "static" tool calling, HDTC uses HATEOAS (Hypermedia as the Engine of Application State) to inform the agent which actions are available in the current resource state.

By combining HAL (Hypertext Application Language) and OpenAPI, HDTC constrains the agent to actions explicitly exposed by the server for the current resource state.

@bymyslf
bymyslf / settings.json
Last active December 29, 2021 14:36
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.7.1091.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@bymyslf
bymyslf / IJobQueue.cs
Created April 9, 2021 13:09
Redis Job Queue
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
public interface IJobQueue
{
Task Finish(string key, CancellationToken cancellationToken = default);
Task Requeue(string key, CancellationToken cancellationToken = default);
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
public class SqlScriptMigrator
@bymyslf
bymyslf / Either.cs
Created April 7, 2020 16:23
C# Either Monad
using System;
public class Either<TLeft, TRight>
{
private readonly TLeft left;
private readonly TRight right;
private readonly bool isLeft;
public Either(TLeft left)
{
@bymyslf
bymyslf / TaskExtensions.cs
Last active February 21, 2021 14:51
Useful task extensions
namespace System.Threading.Tasks
{
using System;
using System.Runtime.CompilerServices;
using System.Threading;
/// <summary>
/// Extensions on Task and Task<T>.
/// </summary>
public static class TaskExtensions
@bymyslf
bymyslf / StreamAssert.cs
Created January 9, 2020 08:55
Compare streams
public static class StreamAssert
{
public static bool AreEquivalent<T>(T left, T right)
where T : Stream
{
int file1byte;
int file2byte;
if (left == right)
{
@bymyslf
bymyslf / .gitconfig
Last active March 20, 2026 21:39
Useful git aliases
[alias]
co = checkout
sw = switch
st = status
unstage = reset HEAD --
last = log -1 HEAD
cln = clean -n
clf = clean -f
cli = clean -i
clfx = clean -fx
@bymyslf
bymyslf / post-merge.sh
Created January 10, 2019 12:39
Git post-merge hook to delete merged branch
#!/bin/bash
# Based on: https://github.com/brianstorti/git-hooks/blob/master/hooks/post-merge
exec < /dev/tty
# Merge can go three ways:
# * F: fast forward: no commit is created, only a ref is changed
# * A: automatic: true merge (non-ff) without conflicts. A new commit is created
# * C: merge with conflicts: no commit is created but the index is prepared (partially)