Skip to content

Instantly share code, notes, and snippets.

View jefftriplett's full-sized avatar
Living the dream

Jeff Triplett jefftriplett

Living the dream
View GitHub Profile
@jefftriplett
jefftriplett / demo-youtube-playlist-to-markdown.py
Last active January 1, 2024 11:18
A YouTube Playlist to Markdown automation
"""
----------------------------------------------------------------------------
Author: Jeff Triplett <https://github.com/jefftriplett>
Copyright (c) 2023 - Jeff Triplett
License: PolyForm Noncommercial License 1.0.0 - https://polyformproject.org/licenses/noncommercial/1.0.0/
----------------------------------------------------------------------------
1. To extract video URLs, titles, and descriptions from a YouTube playlist using Python, you can use the google-api-python-client library. Here's a step-by-step guide on how to do this:
Install the google-api-python-client library:
@jefftriplett
jefftriplett / chatgpt.py
Last active March 1, 2023 20:14
ChatGPT API using their OpenAI Python library to generate a TailwindCSS template
# https://platform.openai.com/docs/guides/chat/chat-vs-completions
#
# python -m pip install openai
#
import openai
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
@jefftriplett
jefftriplett / .env-dist
Last active January 14, 2023 18:42
Using 1password and with ENV variables for Django via a justfile
ADMIN_URL=op://django-news/$APP_ENV/ADMIN_URL
ALLOWED_HOSTS=op://django-news/$APP_ENV/ALLOWED_HOSTS
AWS_ACCESS_KEY_ID=op://django-news/$APP_ENV/AWS_ACCESS_KEY_ID
CURATED_API_KEY=op://django-news/$APP_ENV/CURATED_API_KEY
CURATED_PUBLICATION_KEY=op://django-news/$APP_ENV/CURATED_PUBLICATION_KEY
DATABASE_URL=op://django-news/$APP_ENV/DATABASE_URL
DJANGO_DEBUG=op://django-news/$APP_ENV/DJANGO_DEBUG
USE_S3=op://django-news/$APP_ENV/USE_S3
description newsletter number published title url
PSF News, building a desktop app with Django + Electron, Meilisearch, bulk admin actions, and more!
Django News
160
2022-12-30 11:00:00 +0000
Happy Django New Year!
@jefftriplett
jefftriplett / drf_prefix_mixin.py
Created June 17, 2022 19:30
Example DRF Prefix Mixin for accepted a dict() that might have a model prefix.
class PrefixedMixin:
def __init__(self, *args, **kwargs):
self._prefix = kwargs.pop("prefix", None)
super().__init__(*args, **kwargs)
def to_internal_value(self, data):
"""Dict of native values <- Dict of primitive datatypes."""
if self._prefix:
data = {
key.replace(f"{self._prefix}_", ""): value
@jefftriplett
jefftriplett / code--list-extensions.sh
Created July 28, 2021 17:21
VS Code --list-extensions
❯ code --list-extensions
azemoh.one-monokai
bibhasdn.django-html
bokuweb.vscode-ripgrep
bradlc.vscode-tailwindcss
citycide.theme-material-cosmos
cschleiden.vscode-github-actions
DavidAnson.vscode-markdownlint
donjayamanne.githistory
dracula-theme.theme-dracula
@jefftriplett
jefftriplett / justfile-alfred.py
Last active September 21, 2024 10:35
Example Justfile Alfred Extension
"""
2021-2024 - Jeff Triplett
gist: https://gist.github.com/jefftriplett/e7d4eade12e30001065eed2636010772
pip install typer pydantic
Inspired/jumpstarted by: https://github.com/kjaymiller/Bunch_Alfred
"""
@jefftriplett
jefftriplett / magic-link.py
Last active April 5, 2021 09:29
Django Management Command to print a "Magic Link" for one-click log-in. This is nice for people who project switch or don't want to remember passwords.
@jefftriplett
jefftriplett / Makefile
Created August 30, 2020 21:34
Minimal TailwindCSS setup
.PHONY: static
static:
@npx -p [email protected] tailwindcss build ./assets/index.css \
--config ./assets/tailwind.config.js \
--output ./frontend/css/output.css
@jefftriplett
jefftriplett / docker-compose-project-name.yml
Last active March 4, 2024 10:34
Watchtower in Docker Compose
version: "3.3"
services:
web:
container_name: my-fancy-container
image: docker.pkg.github.com/jefftriplett/private-repo/private-project:latest
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "com.centurylinklabs.watchtower.lifecycle.post-update='./post-update.sh'"