Skip to content

Instantly share code, notes, and snippets.

View WomB0ComB0's full-sized avatar
πŸ˜΅β€πŸ’«
I need an Advil

Mike Odnis WomB0ComB0

πŸ˜΅β€πŸ’«
I need an Advil
View GitHub Profile
@WomB0ComB0
WomB0ComB0 / database.get.ts
Created January 22, 2025 10:00
Prisma x Supabase script to execute on package.json scripts for easy db updates
'use server';
import { exec } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { promisify } from 'node:util';
import { logger } from '@/utils';
const execPromise = promisify(exec);
@WomB0ComB0
WomB0ComB0 / github-secrets.ts
Last active January 24, 2025 00:43
This script automates the process of adding secrets from a local .env file to a GitHub repository. It uses the GitHub API to encrypt and store secrets
/**
* This script automates the process of adding secrets from a local .env file to a GitHub repository.
* It uses the GitHub API to encrypt and store secrets securely using libsodium encryption.
*
* @module github-secrets
*
* How to run this script:
*
* For npm:
* 1. Install dependencies: npm install
@WomB0ComB0
WomB0ComB0 / ics-parser-simple.ts
Created January 24, 2025 20:12
Simple ICS file parser
/**
* A script to parse ICS (iCalendar) files and convert them to JSON format.
* Supports processing either a single file or scanning a directory for multiple .ics files.
*
* @module ics-parser
*
* Usage:
* - Process single file: node ics-parser.ts path/to/file.ics
* - Process all .ics files in root: node ics-parser.ts --root
*
@WomB0ComB0
WomB0ComB0 / ics-parser.ts
Created January 24, 2025 20:16
Advanced, CLI-based ICS parser
/**
* @fileoverview A utility for converting ICS (iCalendar) files to JSON format with customizable output options.
* Supports flattening nested structures, removing fields, renaming keys, and filtering by date range.
*/
import { lines2tree } from 'icalts';
import { $ } from 'bun';
import { Command } from 'commander';
/**
@WomB0ComB0
WomB0ComB0 / create-ics.ts
Created January 24, 2025 20:20
Create ICS files based on input
/**
* @fileoverview Creates an ICS calendar file with recurring events based on provided configuration
*/
import ical, { ICalEventRepeatingFreq, ICalWeekday } from 'ical-generator';
import { writeFileSync } from 'fs';
import { DateTime } from 'luxon';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import type { ICalRepeatingOptions } from 'ical-generator/dist/index.d.ts';
@WomB0ComB0
WomB0ComB0 / auto_commit.sh
Last active March 29, 2025 05:11
Utilizing an AI-powered CLI to incrementally create AI-generated commit messages based on you git changes.
#!/bin/bash
# Still want to catch undefined variables, but don't exit on errors
set -u
# Script configuration
DEFAULT_REPO_DIR="$HOME/github"
DEFAULT_AI_COMMAND="ask cm -m gemini-2.0-flash"
LOG_FILE="/tmp/git-auto-commit-$(date +%Y%m%d-%H%M%S).log"
MAX_RETRIES=3
@WomB0ComB0
WomB0ComB0 / llm-error-handler.ts
Last active February 14, 2025 22:38
Local LLM powered error handler.
import { GoogleGenerativeAI } from '@google/generative-ai';
// Initialize the Google Generative AI client
const genAI = new GoogleGenerativeAI('your-google-api-key'); // Replace with your actual API key
const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
// Example function that might throw an error
function riskyOperation(input: string): string {
if (input.length < 5) {
throw new Error('Input is too short!');
@WomB0ComB0
WomB0ComB0 / tech-scraper-agent.py
Last active February 28, 2025 14:39
Generate article/document summarizations with the Google Gemini API
"""
A comprehensive web scraping and content analysis tool that extracts, summarizes, and documents technical articles.
This module provides functionality to:
- Scrape technical content from web pages
- Extract metadata and images
- Generate AI-powered summaries using Google's Gemini model
- Create and update Google Docs with the processed content
The tool uses type hints throughout and follows strict type safety practices.
@WomB0ComB0
WomB0ComB0 / advanced-web-scraper-template.py
Last active February 26, 2025 09:18
Advanced web scraper template with content segmentation.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=W0611
import json
import logging
import os
import random
import re
import subprocess
@WomB0ComB0
WomB0ComB0 / fire-crawl-cli.ts
Last active February 28, 2025 06:58
Local CLI for FireCrawl
import FireCrawlApp, { MapParams } from '@mendable/firecrawl-js';
import { Command } from 'commander';
import * as dotenv from 'dotenv';
import fs from 'node:fs';
import path from 'node:path';
import ora from 'ora';
import chalk from 'chalk';
dotenv.config();