Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux
Although I highly recommend using a snap
sudo snap install postman
tar -xzf Postman-linux-x64-5.3.2.tar.gz
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
""" | |
Django ORM Optimization Tips | |
Caveats: | |
* Only use optimizations that obfuscate the code if you need to. | |
* Not all of these tips are hard and fast rules. | |
* Use your judgement to determine what improvements are appropriate for your code. | |
""" | |
# --------------------------------------------------------------------------- |
Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux
Although I highly recommend using a snap
sudo snap install postman
tar -xzf Postman-linux-x64-5.3.2.tar.gz
# -*- coding: utf-8 -*- | |
import requests | |
from io import BytesIO, SEEK_SET, SEEK_END | |
class ResponseStream(object): | |
def __init__(self, request_iterator): | |
self._bytes = BytesIO() | |
self._iterator = request_iterator |
$ uname -r
# we need 2 helper mappings, from letters to ints and the inverse | |
L2I = dict(zip("ABCDEFGHIJKLMNOPQRSTUVWXYZ",range(26))) | |
I2L = dict(zip(range(26),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |
key = 3 | |
plaintext = "DEFEND THE EAST WALL OF THE CASTLE" | |
# encipher | |
ciphertext = "" | |
for c in plaintext.upper(): |
from PIL import Image as PILImage | |
import os | |
from django.core.files import File | |
from django.core.files.base import ContentFile | |
from cStringIO import StringIO | |
def create_thumbnail_from_image_field(image_field, thumbnail_image_field, | |
thumb_width, thumb_height): | |
""" | |
This function is intended to be used with a model similar to |