Skip to content

Instantly share code, notes, and snippets.

@andrewboudreau
andrewboudreau / consumers.cs
Last active December 17, 2020 04:23
A consumer which updates document related details when a conversion has completed or failed?
public class PdfConversionCompletedConsumer :
IConsumer<PdfConversionCompleted>,
IConsumer<Fault<ConvertToPdfCommand>>
{
private readonly IDataContext dataContext;
public ConversionCompletedEventHandler(IDataContext dataContext)
{
this.dataContext = dataContext;
}
@andrewboudreau
andrewboudreau / aoc2020_1002.cs
Last active December 17, 2020 14:34
advent of code 2020 day 10 part 2
// Problem: Find the number of paths through a tree where each node can have 1,2 or 3 children?
string SolvePart2(IEnumerable<string> inputs)
{
var adapters = inputs.ToInts().Append(0).OrderBy(x => x).ToList();
long total = 1;
int branches = 0;
var joltage = 0;
@andrewboudreau
andrewboudreau / FileFormat.cs
Last active January 20, 2021 00:43
A way to make file formats more interesting
/// <summary>
/// ContentType describes the type content being stored in the file format.
/// </summary>
public abstract record ContentType(FileExtension Extension, string Name, string Description) : FileFormat(Extension, Name, Description);
public abstract record Email(FileExtension Extension, string Name, string Description) : ContentType(Extension, Name, Description);
public abstract record WordProcessing(FileExtension Extension, string Name, string Description) : ContentType(Extension, Name, Description);
public abstract record Spreadsheet(FileExtension Extension, string Name, string Description) : ContentType(Extension, Name, Description);
public abstract record Presentation(FileExtension Extension, string Name, string Description) : ContentType(Extension, Name, Description);
@andrewboudreau
andrewboudreau / docker-compose.yml
Created June 2, 2021 02:30
compose a helium validator
version: "3.7"
services:
validator:
image: quay.io/team-helium/validator:latest-val-amd64
container_name: validator
init: true
restart: always
ports:
- "2154:2154"
volumes:
Here's a detailed AI prompt that can be used to generate songs using the advanced output strategy and specifically describes 
the usage of the ParseInputArray method and the structure of the string[] and string[][] for the melody, harmony, bass, and drums:

"Generate a four-part song arrangement consisting of melody, harmony, bass, and drums, using a specified format for each part. 
The format for melody, harmony, and bass parts should be a string containing a series of note events separated by commas. 
Each note event should be in the form 'S{channel}:{note}:{duration}:{velocity}', where {channel} represents the channel number 
(1 for melody, 2 for harmony, 3 for bass), {note} is the musical note (e.g., 'C4', 'D#5', 'F#3') or 'R' for a rest, {duration} 
is the duration of the note or rest in milliseconds, and {velocity} is the velocity (loudness) of the note ranging from 0 to 127.