Skip to content

Instantly share code, notes, and snippets.

View spech66's full-sized avatar
😍
enjoying life

Sebastian Pech spech66

😍
enjoying life
View GitHub Profile
@spech66
spech66 / dalle.py
Created January 13, 2024 17:38
Dall-E 3 command line image generator
# Install packages
# pip install python-dotenv openai
# Add your API key to the .env file.
# OPENAI_API_KEY="sk-xxxxxx"
# Run
# python .\dalle.py "a bear in a forest"
import os
import sys
from datetime import datetime
@spech66
spech66 / whisper-yt.py
Last active April 8, 2023 12:22
Summarize Youtube video with OpenAI ChatGPT whisper using YT-DLP
import os
import sys
import yt_dlp
import openai
# Fail if no commandline argument is provided
if len(sys.argv) < 2:
print("Please provide an video link")
exit(1)
@spech66
spech66 / chat.md
Last active April 6, 2023 05:30
Let OpenAI chatgpt-4 output data in JSON and CSV format

ChatGPT allows specifying output formats like JSON or CSV. Test at the OpenAI Playground.

JSON

USER

Classify the following items as fruit or vegetable: apple, banana, cucumber.
Output the data as JSON in the format [{"name": "Apple", "type": "Fruit/Vegetable"}]
@spech66
spech66 / whisperstt.py
Created April 4, 2023 07:37
OpenAI whisper speech to text with ffmpeg based ogg->mp3 converter for WhatsApp messages
import os
import sys
import openai
# Fail if no commandline argument is provided
if len(sys.argv) < 2:
print("Please provide an audio file")
exit(1)
audio_file_name = sys.argv[1]
@spech66
spech66 / add_frontmatter_to_md.ps1
Created October 1, 2022 17:52
Add YAML frontmatter to Markdown files. Obsidian Md.
$mdfiles = Get-ChildItem "." -Filter *.md
foreach($file in Get-ChildItem $mdfiles)
{
Write-Output $file.BaseName
$content = Get-Content $file.FullName -Raw
$mddate = $file.BaseName
$year = $mddate.Substring(0, 4)
$month = $mddate.Substring(5, 2)
@spech66
spech66 / dice.ps1
Created September 22, 2019 15:43
PowerShell roll dice (1D6, 1D20)
# For D6
Get-Random -Minimum 1 -Maximum 7
# or
1..6 | Get-Random
# For D20
Get-Random -Minimum 1 -Maximum 21
# or
1..20 | Get-Random