Skip to content

Instantly share code, notes, and snippets.

View TechMaster's full-sized avatar

Trinh Minh Cuong TechMaster

View GitHub Profile

Huớng các lệnh của psql

Lợi ích của Database schema

  1. To allow many users to use one database without interfering with each other.
  2. To organize database objects into logical groups to make them more manageable.
  3. Third-party applications can be put into separate schemas so they do not collide with the names of other objects.

Does each microservice really need its own database?

  1. Private-tables-per-service – each service owns a set of tables that must only be accessed by that service
  2. Schema-per-service – each service has a database schema that’s private to that service
@TechMaster
TechMaster / postgresql_step_by_step.md
Last active May 9, 2018 04:45
Hướng dẫn thực hành Postgresql

Cài đặt portainer để quản lý Docker container docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Khởi động postgresql container

docker run --name db -e POSTGRES_PASSWORD=123 -d -p 5432:5432 postgres:alpine

Cài đặt pgadmin bằng docker

@TechMaster
TechMaster / mnist_cnn.py
Created September 11, 2019 16:19
Sử dụng CNN để nhận dạng chữ số viết tay MNIST
# Importing the required Keras modules containing model and layers
import tensorflow as tf
from tensorflow.keras import layers
print(tf.__version__)
print("GPU Available: ", tf.test.is_gpu_available())
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
# Reshaping the array to 4-dims so that it can work with the Keras API
x_train = x_train.reshape(x_train.shape[0], 28, 28, 1)
@TechMaster
TechMaster / crud.py
Created September 12, 2019 10:19
Python Sanic CRUD user
from sanic import Sanic
from sanic import response
app = Sanic()
# users = [] # Bước 0: Khởi tạo một danh sách user rỗng
# Bước 4: vào Mockaroo để sinh dữ liệu JSON đểu chạy tạm cái đã
# Bước 6: đóng gói các phương thức tác động lên danh sách user vào một class. Cách này là thủ thuật lập trình hướng đối tượng
# kinh phết đấy!
@TechMaster
TechMaster / perceptron_AND.py
Created September 14, 2019 16:52
Build Perceptron to simulate AND, OR logic. Corner stone to build complex neural network
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
# Code này chạy tốt với AND, OR
def sigmoid(z):
return 1.0 / (1 + np.exp(-z))