Skip to content

Instantly share code, notes, and snippets.

View JupyterJones's full-sized avatar

Jack Northrup JupyterJones

View GitHub Profile
@JupyterJones
JupyterJones / mk_zoom_videos.py
Created February 7, 2024 03:45
Create Zoom Videos from a Directory of Images
import subprocess
import numpy as np
import logging
import glob
import random
import uuid
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s')
def zoom_pan_nonlinear1(input_path, output_path):
@JupyterJones
JupyterJones / conversation_json_to_sessions_txt_html_sqlite_data.ipynb
Created January 17, 2024 04:20
convert ChatGPT conversations.json to sessions txt html and sqlite_data for searching
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JupyterJones
JupyterJones / quantize_mp4.py
Created December 28, 2023 09:42
quantize an entire video
import logging
from moviepy.editor import VideoFileClip, VideoClip, concatenate_videoclips
from PIL import Image
import numpy as np
from sklearn.cluster import KMeans
import random
import os
# Configure logging
logging.basicConfig(filename='script_log.log', level=logging.DEBUG)
@JupyterJones
JupyterJones / quantize_image.py
Created December 28, 2023 09:34
convert any image to a specified rgb array
from PIL import Image, ImageFilter
import os
import cv2
import random
import time
path = r"/home/jack/Desktop/HDD500/SCRIPTS/UGLY_DOLLS/"
#path = r"crawler4/"
base_image = random.choice([
x for x in os.listdir(path)
@JupyterJones
JupyterJones / diagonal_transitions.py
Created December 7, 2023 03:40
create diagonal transitions from a directory of images
#!/home/jack/miniconda3/envs/cloned_base/bin/python
import os
import subprocess
import random
from sys import argv
import uuid
import shutil
def diag_trans(DIR,output_file):
image_dir=DIR
# Get a list of image file names in the directory
@JupyterJones
JupyterJones / Add_Border_Sound_to_Existing_Video.py
Created November 3, 2023 14:46
Add_Border_Sound_to_Existing_Video
from moviepy.editor import VideoFileClip, AudioFileClip, CompositeVideoClip
import random
import glob
def add_title_image(video_path, title_image_path, output_path):
# Load the video file and title image
video_clip = VideoFileClip(video_path)
print(video_clip.size)
width, height = video_clip.size
@JupyterJones
JupyterJones / join3.sh
Created October 25, 2023 04:23
ffmpeg join multiple mp4s
#!/bin/bash
# Define the paths to your input videos
video1='0001.mp4'
video2='0002.mp4'
video3='0003.mp4'
output='real-fish_123.mp4'
# Create a text file to list the input videos
echo "file '$video1'" > input.txt
@JupyterJones
JupyterJones / text2png.sh
Created October 21, 2023 21:40
make a png from a text file
#!/bin/bash
convert -size 512x666 -background black -fill white -font /home/jack/fonts/Arimo-Regular.ttf -pointsize 30 -gravity center caption:@topic.txt -set delay 4 -loop 0 -coalesce -layers Optimize topic.png
@JupyterJones
JupyterJones / falcon_pdf_bot.py
Created October 17, 2023 06:39 — forked from abhishekkrthakur/falcon_pdf_bot.py
This is a reference to the YouTube tutorial here: https://youtu.be/hSQY4N1u3v0
import argparse
from pdfminer.high_level import extract_text
from sentence_transformers import SentenceTransformer, CrossEncoder, util
from text_generation import Client
PREPROMPT = "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n"
PROMPT = """"Use the following pieces of context to answer the question at the end.
If you don't know the answer, just say that you don't know, don't try to
@JupyterJones
JupyterJones / zoomin.py
Created October 1, 2023 16:31
Flask Zoom and Image to video
#!/home/jack/Desktop/FlaskAppArchitect_Flask_App_Creator/env/bin/python3
from flask import Flask, request, render_template, redirect, url_for, flash, send_from_directory
import os
import subprocess
import random
import uuid
import shutil
from werkzeug.utils import secure_filename
import glob
import logging