Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| class PubSub(object): | |
| """ | |
| Very simple Pub/Sub pattern wrapper | |
| using simplified Redis Pub/Sub functionality. | |
| Usage (publisher):: | |
| import redis | |
| r = redis.Redis() |
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
| # https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard | |
| from django.contrib import admin | |
| from django.db.models import Count, Sum, Min, Max, DateTimeField) | |
| from django.db.models.functions import Trunc | |
| from . import models | |
| def get_next_in_date_hierarchy(request, date_hierarchy): |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)| :root { | |
| --violation-color: red; /* used for clear issues */ | |
| --warning-color: orange; /* used for potential issues we should look into */ | |
| } | |
| /* IMAGES */ | |
| /* | |
| * Lazy-Loaded Images Check | |
| * ==== |
| VERSION = \"1.0.0\" | |
| PREFIX ?= out | |
| INCDIR = inc | |
| SRCDIR = src | |
| LANG = c | |
| OBJDIR = .obj | |
| MODULE = binary_name | |
| CC = gcc |