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() |
#!/usr/bin/env python | |
import sys | |
import time | |
import argparse | |
import os | |
import json | |
import socketserver | |
from http.server import BaseHTTPRequestHandler |
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): |
task :default => [:menemen_yap] | |
task :menemen_yap => [:tereyag_al, :yumurta_al, :domates_al, :sivri_biber_al, :sahani_isit, :sebzeleri_pisir, :yumartayi_kir] do | |
puts "Menemen yapıyıyoruz" | |
end | |
task :tereyag_al => [:bakkala_git] do | |
puts "Tereyağı alıyoruz" | |
end |
Magic words:
psql -U postgres
Some 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 | |
* ==== |
I hereby claim:
To claim this, I am signing this object: