Skip to content

Instantly share code, notes, and snippets.

View maietta's full-sized avatar

Nick Maietta maietta

View GitHub Profile
@maietta
maietta / streamdeck-lcd-test.ts
Created March 10, 2025 07:02
Stream Deck Plus LCD testing in TYpeScript & Bun
import { openStreamDeck, listStreamDecks, StreamDeck } from '@elgato-stream-deck/node';
import sharp from 'sharp';
import HID from 'node-hid';
import usb, { LibUSBException } from 'usb';
async function main() {
try {
console.log('Looking for Stream Deck Plus devices...');
// Find the Stream Deck Plus device
@maietta
maietta / intro.md
Created March 6, 2025 20:04
Vibe Coding Cleanup Service

Marketing Website Outline: Vibe Coding Cleanup Crew

General Design Notes

  • Tone: Friendly yet authoritative—appeal to non-technical users while signaling deep expertise.
  • Visuals: Clean, modern design with subtle nods to AI (e.g., abstract code waves) and professionalism (e.g., polished app screenshots).
  • Call-to-Action (CTA): “Get a Free Project Assessment” or “Polish My App Now” on every page.

1. Homepage

@maietta
maietta / limbo.ts
Last active February 21, 2025 17:55
This program uses limbo-wasm to create an in-memory SQLite database that tracks and logs changes to a users table using triggers and a polling listener.
import { Database } from 'limbo-wasm';
// Initialize Limbo database in memory
const db = new Database(':memory:');
// Function to initialize the database with error handling
function initializeDatabase() {
try {
db.exec(`
CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT);
@maietta
maietta / migrate.ts
Created February 15, 2025 04:37
Bun script to migrate SQLite data into Pocketbase via Batch API
import { Database } from 'bun:sqlite';
import PocketBase from 'pocketbase';
const BATCH_SIZE = 50;
const SLEEP_TIME = 1000;
const pb = new PocketBase('https://tx-addresses.pockethost.io');
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
async function migrateData() {
@maietta
maietta / Dockerfile
Created February 14, 2025 04:17
Self hosting SvelteKit SSR applications with Bun latest, with Health-checking.
ARG BUN_VERSION=latest
FROM oven/bun:${BUN_VERSION} AS builder
WORKDIR /app
ENV NODE_ENV=production
# Copy package files first
COPY --link bun.lock package.json ./
# Add conditional installation of svelte-adapter-bun and update config
@maietta
maietta / .env
Created January 17, 2025 04:46
Gitea Webhook Proxy for Coolify
COOLIFY_API_URL=https://coolify.yourdomain.com
COOLIFY_API_KEY=abc123
WEBHOOKS_SECRET=shared-secret-between-gitea-and-deploy
@maietta
maietta / coolify_webhook_proxy_handler.ts
Created January 12, 2025 06:20
Proxies webhook payloads from Gitea and triggers a deploy for a matching repo and branch.
import { serve } from "bun";
import fs from "fs";
// Extract the repository name and branch from the payload
function extractRepoInfo(payload: { repository: { full_name: string }; ref: string }) {
const repoName = payload?.repository?.full_name; // Repository name is in 'full_name'
const branch = payload?.ref?.split("/").pop(); // Branch name is after 'refs/heads/'
return { repoName, branch };
}
@maietta
maietta / +page.svelte
Created December 30, 2024 05:51
Svelte 5 reactive grid/list layout.
<script lang="ts">
import { preferences } from '$lib/stores/preferences'; // Reactive store
import Pagination from './pagination.svelte';
import { truncateDescription, glance } from '$lib/realty/presentation';
let { data } = $props();
let selectedIndex = $state(1);
let listings = $derived(data.results.records);
let pagination = $derived(data.results.pagination);
@maietta
maietta / gallery.svelte
Last active February 15, 2025 04:58
SwiperJS with Svelte 5
@maietta
maietta / SearchForm.svelte
Created December 11, 2024 04:26
Insanely stupid Search Form
<script>
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { onMount } from 'svelte';
import { queryParameters, ssp } from 'sveltekit-search-params';
import { propertySchema } from '$lib/helpers/propertySchema';
import CurrencyInput from '@canutin/svelte-currency-input';
let system = $state({ Class: '', Type: '' });