direnv stdlib | grep -o -E "^(\w+)\(\)"
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 |
This small snippet can be implemented in your Django project to handle locks. It is particularly useful for replacing Redis locks, reducing dependency overhead. To use this snippet, simply copy and adapted to your Django project.
The hash_string function is used to convert a string value into a numerical hash value, as PostgreSQL advisory lock mechanism requires an integer.
Tested on Python3.11 and Django4
Learn more about advisory locks in:
exclude = ["docs/*", "*/migrations/*", ".git/*"] | |
line-length = 100 | |
indent-width = 4 | |
target-version = "py311" | |
[lint] | |
select = [ | |
"E", # pycodestyle errors | |
"W", # pycodestyle warnings | |
"N", # pep8-naming |
import argparse | |
import shlex | |
from typing import List, Optional, TypedDict | |
class Command(TypedDict): | |
prefix: str | |
name: str | |
args: List[str] |
Adjunto encontrarás un script de Python llamado script.py y un archivo CSV llamado data.csv.
El objetivo de este ejercicio es evaluar tus habilidades para identificar problemas, proponer mejoras y más que todo comunicar tus ideas de manera efectiva.
-3502362900466137214 |
matches: | |
- trigger: "!today" | |
replace: "{{mydate}}" | |
vars: | |
- name: mydate | |
type: date | |
params: | |
format: "%d/%m/%Y" | |
- trigger: "!now" |