export AWS_BUCKET_ARN=...
export WEBSITE_DOMAIN=tugerente.com
./sync-bank.sh
Make sure
Comandos AWS CLI:
Apagar una instancia EC2 por ID y esperar a que se detenga:
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
aws ec2 wait instance-stopped --instance-ids i-1234567890abcdef0
Encender una instancia EC2 por ID y esperar a que inicie:
I built this because I wanted React's component patterns in Django templates without switching to a JavaScript frontend. When you use Jinja2 you have macros and that work similar. This will bring the Jinja2 macro experience.
No complex setup, no build process, just practical template components when you need them.
Two template tags, that's it:
The TimestampStateField
creates two related fields in your Django models:
The goal is to do state-tracking where you want to know both IF something is in a state and WHEN it entered that state. For example, tracking if a user is active and when they became active. And with that also gain the benefits of faster DB access and creating more efficient db indexes.
Here's how it works through an example:
Run me like this. Or maybe not! it's dangerous!
curl -sL "https://gist.github.com/mariocesar/b628c91e7b00cca0dca371ac2d54544c/raw/script.py?v=$(date +%s)" | python3 - google.com:443
from celery import Celery | |
from celery.signals import worker_shutdown, task_postrun | |
from django.db import connections | |
app = Celery() | |
... | |
atom dimension { | |
width: int? | |
height: int? | |
depth: int? | |
} | |
atom money { | |
amount: int | |
currency: string | |
} |
from django.db import models | |
from django.contrib.postgres.indexes import GinIndex | |
from django.db.models.functions import Lower | |
class SearchableCharField(models.CharField): | |
def contribute_to_class(self, cls, name, **kwargs): | |
super().contribute_to_class(cls, name, **kwargs) | |
# Add a GIN index with trigram operations for fast search |
""" | |
TODO: Use an strict environment like SandboxedEnvironment | |
TODO: Create an "allowed list" of filters and functions to use in the expression | |
TODO: Make or check the context object is inmutable (Prevent thread-safe situations) | |
""" | |
import json | |
from datetime import datetime | |
from jinja2 import Environment, meta, sandbox |