Skip to content

Instantly share code, notes, and snippets.

View tailtq's full-sized avatar
😋
Working & Dreaming

Tai Le tailtq

😋
Working & Dreaming
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 / docker-compose.kafka.yml
Last active March 10, 2023 14:45
Kafka docker-compose file
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.3.0
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
@tailtq
tailtq / index.html
Last active June 25, 2022 02:57
Git exercises html file
<!DOCTYPE html>
<html>
<body>
<h2>HTML Forms</h2>
<form action="">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
@tailtq
tailtq / README.md
Created June 25, 2022 02:06
Git exercises

Git exercises

Here is what we will practice in the exercises:

  • Create/configure repository
  • Configure account
  • Create new branch / checkout to that branch
  • Add/commit changes
  • Pull from remote/push changes to repository
  • Merge branches
  • Resolve conflict
@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