Skip to content

Instantly share code, notes, and snippets.

View celina-lopez's full-sized avatar
🤠
🐛 🔜 🦋

Celina celina-lopez

🤠
🐛 🔜 🦋
View GitHub Profile
import json, os, requests, openai
openai_api_key = os.getenv('OPENAI_API_KEY')
openai.api_key = openai_api_key
chunks_dir = "novel/chunks/"
edits_dir = "novel/edits/"
#helper function to process files in a directory
def process_directory(d, func):
@thornomad
thornomad / add_frozen_string_literal_comment.rb
Last active February 27, 2023 23:24 — forked from ta1kt0me/add_frozen_string_literal_comment.rb
Add frozen string literal comment into generated files in rails v5.1.0
# frozen_string_literal: true
# Adds a `frozen_string_literal` comment to the top of files created by Rails
# generators.
#
# Originally inspired by:
# https://gist.github.com/ta1kt0me/6a7058d16621785d4f7038bde6cd3b98
# Modified version for Rails 6 at:
# https://gist.github.com/thornomad/4e2f0905e2a4a6eefbc4be5772dfd4f7
@madebyollin
madebyollin / make_audiobook.py
Last active April 8, 2025 23:42
Converts an epub or text file to audiobook via Google Cloud TTS
#!/usr/bin/env python3
"""
To use:
1. install/set-up the google cloud api and dependencies listed on https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/texttospeech/cloud-client
2. install pandoc and pypandoc, also tqdm
3. create and download a service_account.json ("Service account key") from https://console.cloud.google.com/apis/credentials
4. run GOOGLE_APPLICATION_CREDENTIALS=service_account.json python make_audiobook.py book_name.epub
"""
import re
import sys