Skip to content

Instantly share code, notes, and snippets.

@seqis
seqis / gist:5aba0b65ac3f4d66c9cf6825b48d9565
Created June 1, 2025 17:55
This Python script analyzes your local Claude Code conversation logs to track token usage, costs, and provide detailed breakdowns by model and time period (7/30/60 days), automatically exporting data to timestamped CSV files for historical tracking. Since Claude Code may purge local logs after an unknown retention period (estimated 30 days), the…
#!/usr/bin/env python3
"""
Claude Code Usage Tracker - Public Version
IMPORTANT: Run this script periodically (daily recommended) as Claude Code may purge
local conversation logs after an unknown retention period (estimated 30 days based on
feedback transcript retention policy). Set up a cron job to preserve your usage history.
Example crontab entry (runs daily at 8 AM):
0 8 * * * cd /path/to/script && python3 PUBLIC_claude_usage_tracker.py >/dev/null 2>&1
@seqis
seqis / critical_capsule.sh
Created April 25, 2025 18:31
This bash script performs both mirrored and versioned backups every 30 minutes—ideal for running via cron or Task Scheduler—using rsync with hard-link deduplication, time-slot logic, and detailed logging, all while ensuring clean snapshots and efficient storage use.
#!/bin/bash
# ---------------------------------------------------------------------------
# CRITICAL CAPSULE BACKUP SCRIPT (PUBLISHABLE VERSION)
# ---------------------------------------------------------------------------
# This script performs two types of backups every 30 minutes:
#
# 1. **MIRRORED BACKUPS**: One-way sync that mirrors directories to a target.
# - No versioning; it's a direct snapshot of the source as it exists.
#
@seqis
seqis / gist:35b1ab092b113352ac261c6919d15bab
Last active October 18, 2024 03:11
Discussion from this Reddit thread where I plotted what was discussed as a 3D graph: https://www.reddit.com/r/singularity/comments/1g6028b/copilot_o1_just_gave_the_most_mindblowing_answer/
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Create a new figure for the 3D plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Data points for Time (x), Fulfillment (y), and Impact on Others (z)
time = [1, 2, 3, 4, 5]
fulfillment = [1, 2, 4, 6, 8] # Sample y-values for fulfillment
@seqis
seqis / gist:ab6ea9be431d50cd24e6da9e825de3e1
Created September 15, 2024 20:30
This script takes a YouTube URL from the clipboard, retrieves the video’s metadata (including title, uploader, description, tags, and chapters), and fetches the transcript if available. The combined information is then formatted and automatically copied to the clipboard for easy use.
#!/usr/bin/env python3
"""
This Python script takes a YouTube URL from the clipboard, fetches detailed video metadata
and the transcript (if available), and formats it for easy pasting.
The extracted information includes:
- Video Title
- Uploader Name
- Description
@seqis
seqis / gist:9e226b84c056d39ac3fa8ed7b19ee5a7
Created September 15, 2024 20:23
This python script will take any YouTube URL in the clipboard & go out and grab the transcript (if available) and put it directly into the clipboard for pasting.
#!/usr/bin/env python3
# This python script will take any YouTube URL in the clipboard & go out and grab the transcript (if available) and put it directly into the clipboard for pasting.
import pyperclip
from youtube_transcript_api import YouTubeTranscriptApi
import re
import tkinter as tk
def get_video_id(url):
@seqis
seqis / gist:c4ca9671d5d876746f88cb942959d82e
Last active October 4, 2024 17:17
This script sends any text in your clipboard to the OpenAI API for summary and puts that summary right back into the clipboard. You can modify your model name and API key variables below.
#!/usr/bin/env python3
import pyperclip
from openai import OpenAI
# Function to summarize the text using a valid OpenAI model
def summarize_text(text, client):
# Define the instructions for the summarizer
instructions = """
IDENTITY and PURPOSE
@seqis
seqis / gist:34b7c37c577cf232d0c98de98a619d9d
Created September 2, 2024 05:44
This script will track your daily writing progress by reading the total word count from your novel or document's Markdown file (right now it's coded to be NaNoWriMo.md but you can change that) and logs the cumulative and net-new words written each day in a log file (NaNoWriMo_Log.md).
import os
import datetime
import matplotlib.pyplot as plt
# Configuration: User needs to set these variables
vault_path = '/path/to/your/obsidian/vault' # Replace with the actual path to your vault
novel_file = 'NaNoWriMo.md' # Replace with the actual file name if different
log_file = 'NaNoWriMo_Log.md' # This file will store the word counts for each day
target_words = 50000 # NaNoWriMo target word count
@seqis
seqis / gist:b5b6f2e97124e9192fd47323bf962536
Last active September 24, 2024 01:21
This Python script will go to The Guardian and grab the latest NEWS & WEATHER and save it to NEWS.md in your obsidian vault and overwrite it with the latest news every time you run it.
import requests
import feedparser
import os
from datetime import datetime
from bs4 import BeautifulSoup
import re
# **Configuration Section**
# -----------------------------------
# **Important:** Replace the placeholder values below with your actual information.
@seqis
seqis / gist:b043ce792820b560b750898b443a1b6b
Last active March 28, 2025 12:56
This script will take anything in your clipboard, including graphics and create a quick Obsidian note. The graphics will be placed in the `Media` folder under the `Notes` folder. The paths are hard-coded for your current Obsidian vault Notes folder.
#!/bin/bash
# This script will take anything in your clipboard, including graphics and create a quick Obsidian note. The graphics will be placed in the `Media` folder under the `Notes` folder. The paths are hard-coded for your current Obsidian vault Notes folder. This script presumes a "Media" foler exists under your ""Notes" folder.
import os
import subprocess
from datetime import datetime
from PIL import Image
import pyperclip
@seqis
seqis / gist:a4281c7a834d5a9bcdc6ba9e67497fea
Last active October 10, 2024 07:07
Reddit posts and comments downloader plus differential updates - requires Reddit API & Username
#!/usr/bin/env python3
import os
import sys
import re
import praw
from praw.models import Submission, Comment
from datetime import datetime
import prawcore
from tqdm import tqdm
import time