Skip to content

Instantly share code, notes, and snippets.

View BLamy's full-sized avatar

Brett Lamy BLamy

View GitHub Profile

Below is a mental model I’ve found useful when turning FFmpeg (or yt‑dlp + FFmpeg) into a tiny “MCP server” that feels as friendly as, say, an image‑resize API:


1 | Think in “jobs”, not raw CLI flags

  • Job = ( source → transform → destination )
    • source – URL, upload, or pipe
    • transform – one of a handful of named presets (audio‑only/mp3, “YouTube → HLS 360p”, sprite‑sheet, etc.)
    • destination – file download, cloud bucket, or a streamable response
  • The user POSTs a tiny JSON blob; the server turns it into the full FFmpeg command, runs it, and returns a job_id.
export default function debuggerInstrumentation(babel) {
const { types: t } = babel;
/* -------------------------------------------------- *
* Helpers *
* -------------------------------------------------- */
const DEFAULT_MAX_VARS = 10;
/** Build { get a() { … }, … } — TDZ-safe getters */
// babel-plugin-vitest-soft-expect.js
// Transform plain expect(value) → expect.soft(value)
// Escape-hatch: if the statement has a leading // hard comment,
// the call is left unchanged.
export default function expectSoft(babel) {
const { types: t } = babel;
return {
name: "vitest-soft-expect-transform",
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import { readFileSync, readdirSync, existsSync } from 'fs';
import { join, resolve } from 'path';
export default function webcontainerFilesPlugin() {
const virtualModuleId = 'virtual:webcontainer-files';
const resolvedVirtualModuleId = '\0' + virtualModuleId;
return {

Enabling SharedArrayBuffer on GitHub Pages: A Service Worker Solution

GitHub Pages is a fantastic free hosting service for static websites, but it comes with limitations—one being the inability to set custom HTTP headers. This becomes a problem when you need features like SharedArrayBuffer, which requires specific security headers for cross-origin isolation.

In this guide, I'll show you how to work around this limitation using service workers to enable SharedArrayBuffer on GitHub Pages.

The Problem: Cross-Origin Isolation Requirements

Browsers require cross-origin isolation for security-sensitive features like SharedArrayBuffer. This requires two HTTP headers:

Brett Lamy

Contact Information

Professional Summary

Staff Software Engineer with 15 years of experience delivering full-stack products for small startups and large high-scale enterprises. Expertise in full-stack LLM development, data governance, compliance, and mobile development. Passionate about building scalable, efficient, and user-focused software solutions.

Professional Experience

Title: Electron 22.0.0
URL Source: https://www.electronjs.org/blog/electron-22-0
Published Time: 2022-11-29T00:00:00.000Z
Markdown Content:
Electron 22.0.0 has been released! It includes a new utility process API, updates for Windows 7/8/8.1 support, and upgrades to Chromium `108`, V8 `10.8`, and Node.js `16.17.1`. Read below for more details!
* * *
@BLamy
BLamy / gmail-openapi.json
Created October 6, 2023 21:31
gmail-openapi.json
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Gmail API"
},
"paths": {
"/gmail/v1/users/{userId}/threads": {
"get": {
"summary": "Lists the threads in the user's mailbox.",
@BLamy
BLamy / Permissions.ts
Last active July 29, 2023 00:35
Typescript Permission System
// https://tsplay.dev/w2kJrN
import { Brand } from 'ts-brand'
import { z } from 'zod'
//------------------------------------------------
// Permission Levels
enum PermissionLevelEnum {
OWNER_ONLY = "OWNER_ONLY",
COMPANY_ONLY = "COMPANY_ONLY",
PUBLIC = "PUBLIC",
@BLamy
BLamy / ChatBuilder.ts
Last active May 16, 2023 21:00
Typesafe Chat Builder
class Prompt<
TPromptTemplate extends string,
TSuppliedInputArgs extends ExtractArgs<TPromptTemplate, {}>
> {
constructor(
public template: TPromptTemplate,
public args: TSuppliedInputArgs
) {}
toString() {