Skip to content

Instantly share code, notes, and snippets.

View tailtq's full-sized avatar
😶‍🌫️

Tai Le tailtq

😶‍🌫️
View GitHub Profile
@tailtq
tailtq / docker-compose.yaml
Created March 24, 2023 04:07
Docker reestart-policy
version: '3.3'
services:
timescaledb:
image: timescale/timescaledb-ha:pg14-latest
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgresql
volumes:
@tailtq
tailtq / dill_multiprocessing.py
Created March 15, 2023 15:21
Monkey-patching to override Pickle Serializer (not recommended + error-prone)
# pip install dill
import io
import dill as pickle
from weakref import WeakSet
from multiprocessing import reduction
class ForkingPickler(reduction.ForkingPickler):
loads = pickle.loads
@tailtq
tailtq / python-rolling-over-logging.py
Last active April 27, 2022 15:27
Python logging using roll over
import logging
import time
import glob
from threading import Thread
from logging.handlers import TimedRotatingFileHandler
def do_a_heavy_operationnnn():
print("do_a_heavy_operationnnn")
# upload to S3 or whatever
@tailtq
tailtq / MinIO-and-MongoEngine-Syntax.md
Last active October 14, 2020 10:05
Syntax for MinIO and MongoEngine

Setup MinIO and MongoEngine

(Move to next part if you just want to know MinIO and MongoEngine syntax)

These services were setting up using docker-compose. Please refer to this link for the its content.

Setup steps:

  • Download file from the link above and save as docker-compose.yaml
  • Change environment variables for:
    • Mongodb (MONGO_INITDB_ROOT_USERNAME, MONGO_INITDB_ROOT_PASSWORD)
version: '3'
services:
mongodb:
image: 'mongo:latest'
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
ports:
- 11038:27017