Skip to content

Instantly share code, notes, and snippets.

View saalaus's full-sized avatar

Sergey saalaus

View GitHub Profile
@saalaus
saalaus / gpt.py
Created March 8, 2024 07:52
ChatGPT in terminal with multiple line, markdown highlight and keybinds.
# ChatGPT in terminal with multiple line, markdown highlight and keybind.
# requirements - pip install openai==1.3.5 rich==13.7.0 prompt-toolkit==3.0.39
# keybind: ctrl+c - clear input or exit, f1 - new line, enter - send message
# commands: clear - clear context
from openai import OpenAI
from prompt_toolkit import prompt
from prompt_toolkit.key_binding import KeyBindings
from rich.console import Console
from rich.live import Live
@saalaus
saalaus / video.py
Created February 28, 2024 18:13
Make video preview
# Creates previews for videos - random short snippets of 2 seconds each
# pip install moviepy==1.0.3
# use python video.py <input_video_path> <output_video_name> <duration_in_seconds>
from moviepy.video.compositing.concatenate import concatenate_videoclips
from moviepy.editor import VideoFileClip
import sys
import random
import argparse
@saalaus
saalaus / oh-my-posh.json
Created November 30, 2023 10:33
Oh my posh config
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#0077c2",
"foreground": "#ffffff",
"leading_diamond": "╭─",