Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 3.2 KB

README.md

File metadata and controls

50 lines (33 loc) · 3.2 KB

Python Scripts

Standalone Python utilities for random numbers, Windows network diagnostics, audio transcription and keyword detection, and Canva presentation export to PDF. Script messages, help text, and logs are in Portuguese.

Scripts

  • Scripts/Random Secrets/ uses secrets to generate Mega-Sena and Lotofácil numbers, a number from 00 to 99 excluding a fixed set, or a number from a fixed list.
  • Scripts/Troubleshooting/dns_diag.py runs DNS, ping, and NTP diagnostics on Windows.
  • Scripts/find_keyword_in_audio_gpu.py transcribes audio in chunks and searches for keywords using Whisper and CUDA.
  • Scripts/Whisper_Temp.py sets up Whisper and transcribes audio using hard-coded Windows paths.
  • Scripts/canva_export_pdf.py captures Canva viewer slides and combines them into a PDF.

Requirements

Python 3.8+ is required. Python 3.10 or 3.11 is recommended: Whisper_Temp.py pins PyTorch 2.1.2, whose wheels target Python 3.8–3.11. Python versions have not been tested for this collection.

Third-party imports and their pip packages by script:

  • Random Secrets scripts and dns_diag.py: standard library only. DNS diagnostics also require Windows system network commands.
  • canva_export_pdf.py: PIL → Pillow, playwright → playwright, and img2pdf → img2pdf; install Playwright's Chromium browser too.
  • find_keyword_in_audio_gpu.py: pydub → pydub, tqdm → tqdm, torch → torch, and whisper → openai-whisper. It requires CUDA and FFmpeg for audio decoding.
  • Whisper_Temp.py: installs torch, torchaudio, and openai-whisper itself and attempts to obtain FFmpeg via winget.

Install the common third-party packages and Chromium with:

pip install Pillow playwright img2pdf pydub tqdm torch openai-whisper
playwright install chromium

How to run

From the repository root, for example:

python "Scripts/Random Secrets/MegaSena_SecretsLib.py"
python Scripts/Troubleshooting/dns_diag.py --no-flush
python Scripts/find_keyword_in_audio_gpu.py --audio path/to/audio.mp3 --keywords example
python Scripts/canva_export_pdf.py --url "YOUR_VIEWER_URL#1" --slides 10 --out presentation.pdf

The Canva URL must be an accessible viewer link ending in #1. Use --help with the audio, DNS, or Canva script for options.

Before running Whisper_Temp.py, edit its AUDIO and OUTDIR paths and use an isolated environment. It uninstalls WhisperX, pyannote.audio, pyannote.core, pyannote.pipeline, speechbrain, and pytorch-lightning; installs pinned PyTorch and torchaudio 2.1.2 with CUDA 11.8 and a CPU fallback, plus openai-whisper; attempts to install FFmpeg via winget; and waits for ENTER at the end.

Notes and limitations

The keyword script exits if CUDA is unavailable. Its default model is small and its default language is Portuguese; use --language auto for automatic detection. By default it writes the transcript as <audio name>.json in the current directory.

The DNS script exits outside Windows, flushes the DNS cache unless --no-flush is supplied, may require an Administrator terminal, and sends traffic to external DNS resolvers and pool.ntp.br. Canva export depends on viewer access and page behavior. Random numbers do not guarantee lottery results.