Skip to content

Instantly share code, notes, and snippets.

View fry69's full-sized avatar

fry69

View GitHub Profile
@fry69
fry69 / twitter_url_expander.md
Last active November 5, 2024 09:35
Twitter URL expander

Source: Claude.ai

I've created a Python script that expands t.co URLs in a Twitter archive. Here's how to use it:

  1. Install the required packages:
pip install requests tqdm
  1. Run the script with your Twitter archive path:
@fry69
fry69 / axios-fetch.md
Created October 5, 2024 11:48
Wrapper around fetch with similar features like axios

What is the minimal boilerplate around the web API fetch() call to support

  • track request progress
  • intercept middleware
  • handle error states

similar to the very popular axios library without relying on 3rd party libraries or implement the full axios API?


To create a minimal boilerplate around the native fetch() API that mimics some of axios's popular features—such as request interception, progress tracking, and error handling—you can build a wrapper function or a simple class. Below is an example of how to achieve this without relying on third-party libraries.

@fry69
fry69 / gcm-o1-mini.md
Created September 18, 2024 06:04
o1-mini rewrting gcm.sh

The provided gcm shell function is an innovative tool that leverages an AI-powered language model (LLM) to generate concise Git commit messages based on staged changes. This automation enhances workflow efficiency by reducing the cognitive load associated with crafting commit messages manually. Below is a comprehensive analysis of the existing code, along with detailed recommendations for optimizations and improvements to both the codebase and user experience.


1. Code Analysis and Current Functionality

Overview

The gcm function performs the following steps:

  1. Diff Extraction: Retrieves the current staged changes (git diff --cached) while excluding specific lock files (pnpm-lock.yaml, package-lock.json, yarn.lock).
@fry69
fry69 / add_to_zshrc.sh
Last active October 8, 2024 14:18 — forked from karpathy/add_to_zshrc.sh
Git Commit Message AI
# -----------------------------------------------------------------------------
# Enhanced AI-powered Git Commit Function with Optimizations and UX Improvements
# Add this to your ~/.bashrc or ~/.zshrc to utilize the `gcm` command.
# Features:
# 1) Validates required dependencies.
# 2) Checks for staged changes.
# 3) Allows customizable exclusion patterns.
# 4) Generates commit messages using an LLM with an extended prompt.
# 5) Provides user-friendly prompts with color-coded messages.
# 6) Handles errors gracefully with informative feedback.
@fry69
fry69 / extract.py
Created May 16, 2024 05:53
Extract created_at timestamps for OpenRouter models from their webpage
from bs4 import BeautifulSoup
import subprocess
import re
# Any OpenRouter model page should do the trick, e.g.
# curl https://openrouter.ai/models/google/gemini-flash-1.5 > or.html
# Due to skill issues this script needs prettier installed to format the code
# so Python can correctly search it with RegEx