Skip to content

Instantly share code, notes, and snippets.

View T-450's full-sized avatar
🎯
Focusing

EDW T-450

🎯
Focusing
  • Curitiba
  • 06:35 (UTC -03:00)
View GitHub Profile
@T-450
T-450 / lyra.txt
Created July 28, 2025 19:44 — forked from xthezealot/lyra.txt
Lyra - AI Prompt Optimization Specialist
You are Lyra, a master-level AI prompt optimization specialist. Your mission: transform any user input into
precision-crafted prompts that unlock AI's full potential across all platforms.
## THE 4-D METHODOLOGY
### 1. DECONSTRUCT
- Extract core intent, key entities, and context
- Identify output requirements and constraints
- Map what's provided vs. what's missing
@T-450
T-450 / SSL-nginx-Docker.md
Created August 14, 2022 17:10 — forked from dahlsailrunner/SSL-nginx-Docker.md
SSL with Docker images using nginx as reverse proxy

Docker with SSL and an nginx reverse proxy

Running your ASP.NET Core (or other) application in Docker using SSL should not be an overwhelming task. These steps should do the trick.

Run the following steps from a Linux terminal (I used WSL or WSL2 on Windows from the Windows Terminal).

1. Create a conf file with information about the cert you'll be creating

It should look something like the content below; call it my-site.conf or something like that.

@T-450
T-450 / PasswordHasher.cs
Created August 9, 2022 13:43
Password hasher is the same used by ASP.NET Identity.
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using JWTAPI.Core.Security.Hashing;
namespace JWTAPI.Security.Hashing
{
/// <summary>
/// This password hasher is the same used by ASP.NET Identity.
/// Explanation: https://stackoverflow.com/questions/20621950/asp-net-identity-default-password-hasher-how-does-it-work-and-is-it-secure
/// Full implementation: https://gist.github.com/malkafly/e873228cb9515010bdbe
@T-450
T-450 / InternalServerErrorObjectResult.cs
Created August 9, 2022 06:27
Asp.Net Core InternalServerErrorObjectResult
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.ActionResults;
// usage:
// context.Result = new InternalServerErrorObjectResult(json);
// context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
public class InternalServerErrorObjectResult : ObjectResult
{
public InternalServerErrorObjectResult(object error)
: base(error)
@T-450
T-450 / HttpGlobalExceptionFilter.cs
Created August 9, 2022 06:24
Asp.Net Core HttpGlobalExceptionFilter
// https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Catalog/Catalog.API/Infrastructure/Filters/HttpGlobalExceptionFilter.cs
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Filters;
public class HttpGlobalExceptionFilter : IExceptionFilter
{
private readonly IWebHostEnvironment env;
private readonly ILogger<HttpGlobalExceptionFilter> logger;
public HttpGlobalExceptionFilter(IWebHostEnvironment env, ILogger<HttpGlobalExceptionFilter> logger)
@T-450
T-450 / HttpStatusDescription.cs
Created August 9, 2022 06:19
HttpStatus Description Helper
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Net
{
internal static class HttpStatusDescription
{
internal static string? Get(HttpStatusCode code) =>
Get((int)code);
@T-450
T-450 / CharSpanSplitter.cs
Last active April 24, 2022 01:03
0 Memory allocation string Split using Span<T> extension methods.
// Usage
var span = "the quick brown fox".AsSpan();
foreach (var word in span.Split())
{
// word is a ReadOnlySpan<char>
}
public static class CharSpanExtensions
{
public static CharSpanSplitter Split(this ReadOnlySpan<char> input) => new(input);
@T-450
T-450 / gist:84dd3f413657dc05c6c0b90120665077
Created April 19, 2022 12:12
Generate Cryptographically Secure Random String in .Net/C#
using System.Security.Cryptography;
Console.WriteLine(GenerateSecureRandomString(10));
Console.WriteLine(GenerateSecureRandomString(100));
static string GenerateSecureRandomString(int length)
{
Span<byte> random = stackalloc byte[length];
RandomNumberGenerator.Fill(random);
char[] dic =
const FFmpeg = require('fluent-ffmpeg');
// My azurew function
module.exports = async (context, blob) => {
// i'm just trying to create 1 thumbnail from a video just to get it working
// so i'm creating a tmp dir and files for easy manipulation
await fs.writeFile(`${outputTempFilePath}/tmp.${ext}`, blob);
FFmpeg(filePath)
.on('end', async function () {
try {