Skip to content

Instantly share code, notes, and snippets.

View adamghill's full-sized avatar

Adam Hill adamghill

View GitHub Profile
@adamghill
adamghill / !render-checklist.md
Last active September 6, 2023 03:40
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
@adamghill
adamghill / hacker-news-readable.css
Created January 28, 2022 22:57
Hacker News Readable CSS
/* https://userstyles.org/styles/133201/hacker-news-readable */
/* reset */
body, td, table, input, textarea, .pagetop, *
{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-weight: 400;
-webkit-font-smoothing: antialiased;
}
@adamghill
adamghill / scorched_earth.sh
Last active September 25, 2023 18:08
Start from scratch for database migrations in Django
#!/bin/sh
set -e
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "Database name argument is required"
@adamghill
adamghill / Procfile
Last active November 13, 2022 16:31
Settings, files, and a checklist to deploy a Django app to Heroku with nginx + gunicorn + postgres + redis and using `poetry` for dependencies.
web: python manage.py collectstatic --noinput && bin/start-pgbouncer bin/start-nginx gunicorn -c gunicorn.conf.py project.wsgi
@adamghill
adamghill / pyproject.toml
Last active December 18, 2022 21:43
Default pyproject.toml for Django projects
[tool.poetry]
name = ""
version = "0.1.0"
description = ""
authors = [""]
[tool.poetry.dependencies]
python = "^3.9"
Django = ">3"
django-fbv = "<1"
@adamghill
adamghill / settings.json
Last active March 3, 2024 15:59
VS Code settings
{
"editor.minimap.enabled": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.defaultFormatter": "HookyQR.beautify"
},
@adamghill
adamghill / heart.html
Created August 21, 2020 15:38
Beating heart animation
<!--
From https://ackee.electerious.com/
-->
<style>
.heart {
width: 16px;
height: 16px;
fill: #73fac8;
margin: 0 4px -1px;
@adamghill
adamghill / yeti.css
Created March 4, 2020 15:57
Yeti styles for goatcounter.com (https://jenil.github.io/bulmaswatch/yeti/)
@-moz-document domain("goatcounter.com"), domain("stats.arp242.net") {
html, body {
background-color: white;
}
.page {
padding-top: 4em;
box-shadow: none;
}
@adamghill
adamghill / create_setup.py
Created February 7, 2020 23:27
Convert pyproject.toml to setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2019-12-18
# @Filename: create_setup.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
# https://github.com/sdss/flicamera/blob/master/create_setup.py
# This is a temporary solution for the fact that pip install . fails with
@adamghill
adamghill / apps.py
Last active May 5, 2022 09:03
Watch .env file for changes in a Django app
from django.apps import AppConfig
from django.conf import settings
from django.utils.autoreload import autoreload_started
class Config(AppConfig):
name = "random_app_name"
def ready(self):
autoreload_started.connect(watch_env)