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
@adamghill
adamghill / !render-checklist.md
Last active September 19, 2024 12:30
Settings, files, and a checklist to deploy a Django app to Render with gunicorn + redis and using `poetry` for dependencies.
  • GitHub for code
  • Render blueprint specified by render.yaml
    • Postgres
    • Redis
    • Linked to GitHub repo
    • Add environment variables for PYTHON_VERISON=3.9.7, ENVIRONMENT=live, and SECRET_KEY
  • Cloudflare for SSL and CNAME pointing to Render app domain
    • Force SSL with a Cloudflare rule
  • Namecheap for the domain
  • Point nameservers to Cloudflare
@ipmb
ipmb / dejunk-twitter.txt
Created July 26, 2022 16:25
uBlock Origin custom filters to dejunk twitter
twitter.com##[aria-label$="Trending now" i]
twitter.com##article [aria-label^="Recommended Topic" i]:upward(article)
@bennylope
bennylope / migrate.py
Last active July 18, 2023 05:43
PostgreSQL migration script, Heroku -> Crunchy
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
import time
# Required so we don't generate tons of logs during restore
disable_logging_sql = "ALTER USER postgres RESET pgaudit.log;"
@D2theR
D2theR / README.md
Last active February 28, 2024 17:34
Auto-generates Serializers & ModelViewSets in a Django API using just models

Why?

I got sick of writing the same Serializer & ModelViewSet classes over and over so I found and wrote some code to do it for me, and somehow it works! Please note that there are a lot of caveats to running an API like this and while this may work, I know there's A LOT of room for improvement, feel free to fork and help!

USAGE

Import the router module to your main sites urls.py file as the injection point like so... Make sure to remove any other imports from other viewsets that you don't need that may conflict!

@julianwachholz
julianwachholz / sw.js
Created January 12, 2022 15:37
Django ServiceWorker view
// service worker
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open("{{ cache_key }}").then((cache) =>
cache.addAll([
// {% for asset in assets %}
"{{ asset }}",
// {% endfor %}
])
)
@chipx86
chipx86 / pypi-find-earliest.py
Created December 22, 2021 01:42
Find the earliest available Python packages matching given dependency ranges
"""Find the earliest available version of a list of Python dependencies.
This takes dependencies on the command line (package names with or without
version specifiers), looks up each in PyPI, and outputs a new list of
dependencies that specify the earliest version in each range.
See https://twitter.com/simonw/status/1473441058667130881 for the reason for
this script.
Example:
@gladiatr72
gladiatr72 / deployment-status-to-env.yaml
Last active December 16, 2021 20:52
pull status elements into environment
spec:
containers:
-
name: misc
image: gladiatr72/misc:util-21
env:
-
name: POD_IP
valueFrom:
fieldRef:
@brettcannon
brettcannon / back-in-my-day.py
Created November 26, 2021 22:31
Make Jeff feel better about Python packaging
"""Back in my day, we only needed **one** command. 🧓"""
import runpy
import sys
def run(command):
sys.argv[0] = command
runpy.run_module(command, run_name="__main__")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Single File Web Component</title>
<style>
body {
background-color: #eee;
font-family: Helvetica, sans-serif;
}
@kjaymiller
kjaymiller / Apps.md
Last active July 22, 2022 16:54
Apps I Use

Apps I Use

Last Updated: 22 July 2022

  • [Acorn][9955-0001]
  • [Affinity Photo][9955-0002]
  • [BBEdit][9955-0003]
  • [Cardhop][9955-0004]
  • [ColorSlurp][9955-0005]
  • [Craft][9955-0006]
  • [Dark Noise][9955-0007]