Skip to content

Instantly share code, notes, and snippets.

View aybruhm's full-sized avatar
Continuous Improvement (改善)

Abram aybruhm

Continuous Improvement (改善)
View GitHub Profile
aybruhm / docker-python-backend-stack.yml
Last active December 13, 2023 09:55
A complete docker stack {postgres, pgadmin, redis, celery worker, celery beat, flower} for your python web application.
version: "3.9"
build: .
restart: always
container_name: api
- "3456:3456"
aybruhm /
Last active May 27, 2023 12:48
This code snippet is a configuration if you wish to log your Django application.
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Logging configuration
"version": 1,
aybruhm / deploy-python-webapp-to-vps.yml
Last active February 26, 2023 01:32
This is an action workflow that will deploy your python (django, fastapi, flask) application to a VPS (Digital Ocean, EC2 Instance, etc)
name: Build & Deploy
- dev
runs-on: ubuntu-latest
aybruhm /
Last active February 7, 2023 21:50
The below code defines a Python class named MongoDB that provides a base wrapper for connecting to a MongoDB database.
# Third-party Imports
import pymongo
import motor
class MongoDB(object):
"""Base wrapper to connect to MongoDB"""
def __init__(self):
"""Initialize the MongoDB connection"""
aybruhm /
Created February 4, 2023 17:40
Have the function ArrayChallenge(arr) read the array of numbers stored in arr which will contain a sliding window size, N, as the first element in the array and the rest will be a list of numbers. Your program should return the Moving Median for each element based on the element and its N-1 predecessors, where N is the sliding window size. The f…
def ArrayChallenge(arr):
# N -> first number in array
N = arr[0]
# empty list of numbers
res = []
# loop through the length of arrays,
# starting from one
aybruhm /
Created April 14, 2021 14:47 — forked from jacklinke/
Django models cheatsheet
import uuid
from django.db import models
# Use the import below instead, if using GeoDjango fields
# from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.postgres.fields import (