Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
To setup native Linux, see this gist
Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
To setup native Linux, see this gist
| import logging | |
| import sentry_sdk | |
| from ratelimitingfilter import RateLimitingFilter | |
| from sentry_sdk.integrations.django import DjangoIntegration | |
| from sentry_sdk.integrations.logging import LoggingIntegration | |
| # Sentry | |
| sentry_logging = LoggingIntegration( | |
| level=logging.INFO, # Capture info and above as breadcrumbs |
Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
To setup native Linux, see this gist
| def lambda_handler(event, context): | |
| import subprocess | |
| result = subprocess.call("curl -I http://foo.bar", shell=True) | |
| return result | |
| # Redis Cheatsheet | |
| # All the commands you need to know | |
| redis-server /path/redis.conf # start redis with the related configuration file | |
| redis-cli # opens a redis prompt | |
| # Strings. |
A curated list of AWS resources to prepare for the AWS Certifications
A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.
| """ | |
| Logical deletion for Django models. Uses is_void flag | |
| to hide discarded items from queries. Overrides delete | |
| methods to set flag and soft-delete instead of removing | |
| rows from the database. | |
| """ | |
| from django.apps import apps | |
| from django.contrib.admin.utils import NestedObjects | |
| from django.db import models | |
| from django.db.models import signals |
| # Assumes the database container is named 'db' | |
| DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
| DB_HOSTNAME=db | |
| DB_USER=postgres | |
| LOCAL_DUMP_PATH="path/to/local.dump" | |
| docker-compose up -d db | |
| docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" | |
| docker-compose stop db |
| import requests | |
| def get_data_doc_number(user, password, tipo_doc, numero_doc, format='json'): | |
| ''' | |
| # url = 'http://py-devs.com:8888/api' | |
| url = 'http://py-devs.com/api' | |
| tipo_doc = 'dni' o 'ruc' | |
| ''' | |
| url = 'http://py-devs.com/api' | |
| # url = 'http://localhost:8000/api' |