Skip to content

Instantly share code, notes, and snippets.

View adamghill's full-sized avatar

Adam Hill adamghill

View GitHub Profile
View conjure.js
// This was an initial prototype, but has the latest version
adamghill /
Created December 2, 2023 20:51
Helper method to verify two dictionaries are the same with helpful error messages
from typing import Union
def assert_dictionaries(dictionary_one: Union[dict, list], dictionary_two: dict) -> None:
"""Helper method to verify two dictionaries are the same. Display helpful error messages
when the two dictionaries are different.
dictionary_one: The first dictionary.
dictionary_two: The second dictionary.
adamghill /
Created November 10, 2023 17:34
timeit decorator
from contextlib import contextmanager
import time
def timeit():
Decorator that prints out how long a function took to run.
now = time.monotonic()
adamghill / dork.js
Last active November 18, 2023 03:20
The most important JavaScript framework ever created.
View dork.js
dork.js |
The most important JavaScript framework ever created.
function _get_el(el) {
if (typeof el == "string") {
el = $(el);
adamghill / stargazers.gql
Last active November 16, 2023 00:05
Get last stargazers for repos
View stargazers.gql
# Query GitHub for all new stargazers for a particular user's repositories
query($login: String!) {
user(login: $login) {
repositories(last: 5, orderBy: {field: STARGAZERS, direction: ASC}) {
edges {
node {
adamghill / deploy-to-caprover.yml
Last active November 26, 2023 19:36
GitHub Action to build and deploy Docker image to CapRover
View deploy-to-caprover.yml
# Might be outdated! Check for the latest version.
name: Create and publish Docker image to CapRover
# Requires the following Action secrets to be set in your GitHub repo:
adamghill / !
Created December 19, 2022 01:48
Steps to create a new Django project
View !
adamghill /
Created December 5, 2022 15:16
Reading material on how to be a better software engineer?

Responses from, but sans the drama and only containing books not about coding.

  • The Goal by Eli Goldratt: It is a novel about optimizing a factory, but it is immensely valuable in thinking through what are the actual constraints on your team's ability to deliver software and how do you fix it without making other things worse. The Phoenix Project is kind of a modern retelling, but I'd start with The Goal.
  • The Principles of Product Development Flow by Reinersten: Great for thinking deeply about how you deliver value through your system and the tradeoffs you are making in what you choose to focus on next. Once again it isn't specific to software, but very relevant.
  • The 5 Dysfunctions of Teams by Lencioni: Common team problems and what to do instead.
  • Influence: Science and Practice by Cialdini - How to get people into agreement so you can move forward--a skill that can be used for both good and evil.
adamghill / backup-restore-postgres
Created December 3, 2022 21:15
Backup and restore postgres database
View backup-restore-postgres
PGPASSWORD=PASSWORD pg_dump -h HOST_URL -p PORT -U USER --format=custom --no-acl --no-owner DATABASE_NAME > sql.dump
PGPASSWORD=PASSWORD pg_restore --verbose --clean --no-acl --no-owner -h HOST_URL -p PORT -U USER -d DATABASE_NAME sql.dump
adamghill / !
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.
View !
  • 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