Set of python scripts for task automation using AI
Influenced by Daniel Miessler's talk about Fabric on David Bombal's podcast
First export your OpenAI key and install Python requirements
cd ai-automation
export OPENAI_API_KEY=sk-...
pip install -r requirements.txt
or pip3 install -r requirements.txt
-
copy security article and save it to a text file (text.txt)
-
run
python3 security.py -f text.txt
-
output will be saved as json file
or
-
copy security article you want to analyze (copy the web page contents)
-
on macOS*
pbpaste | python3 security.py
-
output will be saved as json file
-
copy security article and save it to a text file (text.txt)
-
run
python3 extractor.py -f text.txt
-
output will be saved as markdown file
or
-
copy article you want to analyze (crtl+c the web page contents or text of the article)
-
on macOS*
pbpaste | python3 extractor.py
-
output will be saved as markdown file
-
copy security article and save it to a text file (text.txt)
-
run
python3 explain_code.py -f text.txt
-
output will be saved as markdown file
or
-
copy code you want to analyze (crtl+c the piece of code)
-
on macOS*
pbpaste | python3 explain_code.py
-
output will be saved as markdown file
Chaining commands: Extract knowledge from YouTube video (subtitles) and provide a readout (mp3 file)
-
copy url of the YouTube video (e.g.
https://www.youtube.com/watch?v=vF-MQmVxnCs
) -
on macOS*
pbpaste | python3 youtube.py | python3 extractor.py | python3 tts.py
-
output will be saved as mp3 file
This will:
- Get subtitles of the Youtube video.
- Extract knowledge using ChatGPT
- Get audio of the result in mp3 format
On Linux you can install xclip.
sudo apt install xclip
The same as way pbpaste
on macOS it will paste contents from clipboard to your Linux terminal.
Example xclip -selection clipboard -o | python3 youtube.py | python3 extractor.py
You can also set alias in your .bashrc profile
alias pbpaste='xclip -selection clipboard -o'
On Windows use Get-Clipboard
for pasting into your PowerShell terminal
Example Get-Clipboard | python3 youtube.py | python3 extractor.py