Skip to content

Instantly share code, notes, and snippets.

View bplunkert's full-sized avatar

Ben Plunkert bplunkert

View GitHub Profile
$a='$a=%s;printf $a.";","\x27$a\x27"';printf $a.";","\x27$a\x27";
@bplunkert
bplunkert / portfolio_checker.rb
Created May 23, 2017 21:10
Cryptocurrency portfolio checker
#!/usr/bin/env ruby
balances = {
'BTC' => 0,
'DASH' => 0,
'ETH' => 0,
'LTC' => 0,
'NMC' => 0,
'XMR' => 0
}
from revChatGPT.revChatGPT import Chatbot
import json
import os
# Get your config in JSON
config = {
"Authorization": "<API-KEY>",
"session_token": os.environ["CHATGPT_SESSION_TOKEN"]
}
@bplunkert
bplunkert / GPT commit message writer
Last active December 18, 2022 22:38
GPT writes commit messages for you
#!/bin/bash
# This file goes in .git/hooks/commit-msg
set -e
git_diff=$(cat "$1")
prompt="I want you to help me write a commit message. When I send the output of git diff, I want you to send only a suggested git commit message (only the message, no commands, nothing else), and do not send any explanation or anything else with it. Here is the git diff:\n${git_diff}"
(echo "$prompt") | openai complete - >> "$1"
@bplunkert
bplunkert / gpt3.html
Created December 20, 2022 05:51
A Javascript GPT3 interface, written by GPT3
<html>
<head>
<title>OpenAI API Test</title>
</head>
<body>
<form id="form">
API Key: <input type="text" id="apiKey"><br>
Model:
<select id="model">
<option value="text-davinci-003">text-davinci-003</option>
@bplunkert
bplunkert / conversation.py
Last active December 21, 2022 19:17
Run a conversation between two GPT bots each with their own memories (extended context)
import json
import openai
import os
if not 'OPENAI_API_KEY' in os.environ:
raise Exception('Environment variable OPENAI_API_KEY is required')
temperature = 0.9
max_tokens = 2000
top_p = 1.0
@bplunkert
bplunkert / insult.html
Last active December 21, 2022 03:05
GPT-3 insult game
<!DOCTYPE html>
<html>
<head>
<title>Insult Game</title>
</head>
<body>
<h1>Insult Game</h1>
<p>This game will increment a counter when you type something mean. If you type anything that isn't mean, it won't increment the counter.</p>
<form onsubmit="submitInsult(event)">
<label for="apiKey">API Key:</label><br>
@bplunkert
bplunkert / cat_counter.py
Last active July 8, 2024 11:27
A simple image classifier that uses llava and an ollama endpoint to do local image classification
#!/usr/bin/env python3
import base64
import json
import os
import requests
# Function to find image files in the current directory
def find_image_files(directory):
image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff']
image_files = [file for file in os.listdir(directory) if os.path.splitext(file)[1].lower() in image_extensions]
@bplunkert
bplunkert / github_star_summarizer.py
Created August 22, 2024 13:27
Github Star Summarizer
"""
Gets a list of a user's starred repos, reads descriptions for all the repos, categorizes, summarizes and quantifies the user's interests.
"""
import requests
import os
from openai import OpenAI
# Initialize OpenAI client with API key from environment variable
client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
@bplunkert
bplunkert / download_videos.py
Last active November 13, 2024 11:56
Youtube Channel Scraper
#!/usr/bin/env python3
# Downloads every video from a Youtube channel in highest quality
# Example:
# export CHANNEL_URL="https://www.youtube.com/@psicoactivopodcast/videos"
# docker run -v ./downloads:/downloads -e CHANNEL_URL="${CHANNEL_URL}" youtube-downloader
import yt_dlp
import os