Skip to content

Instantly share code, notes, and snippets.

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

Marco Minerva marcominerva

🏠
Working from home
View GitHub Profile
@marcominerva
marcominerva / AudioRecorder.cs
Created July 3, 2026 08:38
AudioRecorder.cs
using Microsoft.JSInterop;
namespace MeetingManager.Components.Services;
internal sealed class AudioRecorder(IJSRuntime jsRuntime, string modulePath = "./js/audio-recorder.js") : IAsyncDisposable
{
private readonly IJSRuntime jsRuntime = jsRuntime;
private IJSObjectReference module = null!;
public bool IsRecording { get; private set; }
@marcominerva
marcominerva / audio-recorder.js
Created July 3, 2026 08:37
audio-recorder.js
let mediaStream;
let mediaRecorder;
let chunks = [];
let isStopping = false;
let recordingMimeType = "audio/webm";
export async function startRecording() {
if (mediaRecorder?.state === "recording" || isStopping) {
return;
}
@marcominerva
marcominerva / deploy_react.yml
Created April 13, 2026 08:40
Minimal GitHub action to deploy a React app on Azure App Service
name: Deploy on Azure
permissions:
contents: read
on:
push:
branches: [ master ]
paths: [ 'src/**' ]
workflow_dispatch:
@marcominerva
marcominerva / deploy_angular.yml
Last active April 13, 2026 08:39
Minimal GitHub action to deploy an Angular app on Azure App Service
name: Deploy on Azure
permissions:
contents: read
on:
push:
branches: [ master ]
paths: [ 'src/**' ]
workflow_dispatch:
@marcominerva
marcominerva / deploy.yml
Last active April 13, 2026 08:39
Minimal GitHub action to deploy a .NET Web App on Azure App Service
name: Deploy on Azure
permissions:
contents: read
on:
push:
branches: [ master ]
paths: [ 'src/**' ]
workflow_dispatch:
public interface IDataContext
{
ValueTask<T?> GetObjectAsync<T>(int id) where T : class;
IQueryable<T> GetData<T>(bool trackingChanges = false, bool ignoreQueryFilters = false) where T : class;
IQueryable<T> GetData<T>(string sql, params object?[] arguments) where T : class;
IQueryable<T> GetDataFromStoredProcedure<T>(string command, params object?[] arguments) where T : class;
@marcominerva
marcominerva / MistralOcrMarkdown.cs
Last active May 8, 2025 21:52
Mistral OCR - Get markdown from PDF
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
var endpoint = "https://<endpoint>.<region>.models.ai.azure.com/";
var apiKey = "";
var inputFilePath = @""; // The path of the source PDF
var outputFilePath = @""; // The path of the destination Markdown file
@marcominerva
marcominerva / docker-compose.yml
Created June 12, 2024 14:24
Create a PostgreSQL container with pgAdmin
version: "3.8"
services:
db:
image: postgres
container_name: local_pgdb
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: pi
@marcominerva
marcominerva / Directory.Build.proprs
Created April 8, 2024 13:20
Reduce path in Stack Trace
<Project>
<PropertyGroup>
<PathMap>$(MSBuildThisFileDirectory)=./</PathMap>
</PropertyGroup>
</Project>
using System.Diagnostics;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using OperationResults.AspNetCore.Http;
namespace MinimalApi.Filters;
public class ValidatorFilter<T>(IValidator<T> validator, OperationResultOptions options) : IEndpointFilter where T : class
{
public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)