poetry new <project-name>
poetry add <library>
import aioredis | |
from fastapi import FastAPI | |
from api.views import router as api_router | |
from ws.views import router as wss_router | |
from config import redis_config | |
async def redis_pool(db: int = 0): | |
""" |
""" | |
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): |
knowledge dump on container runtimes | |
KataContainers | |
- image coupled with kernel | |
- light vm layer | |
- can run in nested virturalization environments if hardware supports and you can enable it in bios (ex. only bare metal EC2 instances, limits many cloud providers) | |
- slower startup time | |
- OCI compliant | |
- previously known as ClearContainers by Intel |
ansible-playbook --connection=local 127.0.0.1 playbook.yml
127.0.0.1 ansible_connection=local
#!/usr/bin/env python3 | |
import asyncio | |
import multiprocessing | |
import os | |
import ssl | |
from time import sleep | |
port = 9000 |
# -*- coding:utf-8 -*- | |
from __future__ import absolute_import | |
from __future__ import unicode_literals | |
from __future__ import print_function | |
import json | |
import uuid | |
import time | |
import gevent |
User.aggregate([ | |
{ | |
/* Filter out users who have not yet subscribed */ | |
$match: { | |
/* "joined" is an ISODate field */ | |
'subscription.joined': {$ne: null} | |
} | |
}, | |
{ | |
/* group by year and month of the subscription event */ |
#!/bin/bash | |
REMOTE=play@SERVER_IP | |
REMOTE_APP=/home/play/PROJECT_NAME/ | |
sbt stage || exit 1; | |
ssh $REMOTE "cd $REMOTE_APP; ./stop.sh"; | |
rsync -va target/ $REMOTE:$REMOTE_APP/target | |
ssh $REMOTE "cd $REMOTE_APP; ./start.sh"; |