Skip to content

Instantly share code, notes, and snippets.

View duonghuuphuc's full-sized avatar

Duong Huu Phuc duonghuuphuc

View GitHub Profile
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-12.md
Created February 16, 2025 05:00
Case Study: Implementing Domain-Driven Design (DDD) in Microservices – The Transformation of FinBank

Case Study: Implementing Domain-Driven Design (DDD) in Microservices – The Transformation of FinBank

Background

FinBank is a mid-sized financial institution that provides banking services such as account management, loan processing, credit card services, and fraud detection. Initially, the system was developed using a monolithic architecture, where all features were integrated into a single codebase.

Challenges in the Monolithic System

As the customer base grew, the monolithic system faced several challenges:

  1. Complex Codebase – Banking logic was scattered across different modules, making updates risky.
  2. Scalability Issues – High traffic on one feature (e.g., loan processing) impacted the entire system.
  3. Deployment Bottlenecks – A small bug fix in the credit card module required redeploying the entire application.
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-11.md
Created February 16, 2025 04:36
Case Study: Ensuring Loose Coupling and High Cohesion in Microservices - The Journey of FoodExpress

Case Study: Ensuring Loose Coupling and High Cohesion in Microservices - The Journey of FoodExpress

Background

FoodExpress is an online food delivery platform that connects customers with restaurants. Initially, it was developed using a monolithic architecture, where all functionalities—such as user authentication, restaurant management, order processing, payments, delivery tracking, and customer reviews—were combined in a single application.

As FoodExpress expanded to new cities, it faced serious challenges:

  1. Scaling Issues - A surge in orders during peak meal times slowed down the entire application.
  2. Deployment Bottlenecks - A minor change in the restaurant menu system required redeploying the entire application.
  3. Team Dependencies - Different teams working on unrelated functionalities had to coordinate their code changes.
  4. Performance Degradation - Certain features (like reviews and recommendations) were overwhelming the database, impacting critical services like
@duonghuuphuc
duonghuuphuc / cs504070-casestudy-10.md
Created February 16, 2025 04:25
Case Study: Transitioning from a Monolith to Microservices - A Retail E-commerce Platform

Case Study: Transitioning from a Monolith to Microservices - A Retail E-commerce Platform

Background

ShopEase, a mid-sized e-commerce company, has been running its online shopping platform for five years. Initially, the company used a monolithic architecture, where all features—including user authentication, product catalog, orders, payments, and customer reviews—were tightly coupled in a single application.

Challenges with the Monolithic Approach

As ShopEase grew, it faced several problems:

  1. Scalability Issues - During peak shopping seasons, the entire application slowed down due to high traffic on just one module (e.g., checkout).
  2. Deployment Bottlenecks - A minor bug fix in the payment module required redeploying the entire application, increasing the risk of downtime.
  3. Limited Technology Choices - Since the monolith was built using Java, developers couldn’t adopt better-suited technologies for different features (e.g., Python for recommendation systems).
@duonghuuphuc
duonghuuphuc / disable-base-conda-env.md
Created January 28, 2025 10:03
[macOS] Disable Automatic Activation of the base Conda Environment

[macOS] Disable Automatic Activation of the base Conda Environment

After installing Anaconda on your macOS system, the base environment is automatically activated each time you open a Terminal window. To disable this behavior, follow these steps:

Steps to Prevent Automatic Activation

  1. Open the Terminal
    After installing Anaconda, launch a Terminal window or Anaconda Navigator.

  2. Check the .zshrc Configuration File

@duonghuuphuc
duonghuuphuc / change-ollama-model-dir.md
Created January 27, 2025 04:13
Change Ollama Model Directory

[macOS] Change Ollama Model Directory

By default, all models pulled from Ollama are stored in the /Users/username/.ollama directory on macOS, where username is your system's current user. If you want to change the model directory to another location, such as an external storage device, you can follow one of the methods below.


Method 1: Temporarily Change the Model Directory

If you only want to change the model directory temporarily, execute the following command in Terminal and restart the Ollama app:

Python Program to Generate a Random Phone Number in Vietnam Format

This Python program generates a random 10-digit phone number in the Vietnam format. The first three digits are predefined from a list of valid prefixes, while the remaining digits are randomly generated.

Code

import random
@duonghuuphuc
duonghuuphuc / install-anaconda-mac-arm.md
Created May 11, 2023 04:18
Install Anaconda on Mac computers with Apple silicon

Install Anaconda on Mac computers with Apple silicon

Starting with macOS Catalina (10.15), the macOS will use zsh as the default shell across the operating system. Thus, there are some software that run on Terminal will have different configuration than the previous bash shell. This article will present how to install Anaconda on Mac computers with Apple silicon which run macOS Ventura (13.3.1) and zsh as the default shell. The article will also address the "This package is incompatible with this version of macOS." issue that happens when using the installation file download from Anaconda website.

Install homebrew

Homebrew is a package manager for macOS which lets you install development tools and software. Homebrew can be installed on your computer by executing the below command in Terminal.

@duonghuuphuc
duonghuuphuc / install-onedrive-macos-10.15.7.md
Created April 15, 2023 05:29
Microsoft OneDrive could not work normally since version 23.061 on macOS 10.15.7 (19H2026). This issue may come from Microsoft decision. Thus, this tutorial will show how to install the latest working version of Microsoft OneDrive.

Install Microsoft OneDrive on macOS 10.15.7

Microsoft OneDrive could not work normally from version 23.061 on macOS 10.15.7 (19H2026). This issue may come from Microsoft decision, not your computer. Thus, this tutorial will show how to install the latest working version of Microsoft OneDrive on macOS 10.15.7.

Download and Install

  1. The latest working version of Microsoft OneDrive on macOS 10.15.7 is 23.002.0102.0004. You can download it from Microsoft or here.
  2. Turn off internet connection and install the downloaded file. You must uninstall previous version of Microsoft OneDrive from your computer before installing the downloaded file.
  3. Open Activity Monitor app and force quit StandaloneUpdater app.
  4. Do not launch Microsoft OneDrive app at this step; instead, you do move to the next step.
@duonghuuphuc
duonghuuphuc / microsoft-wordament-hints.md
Created October 15, 2022 06:23
Hints for Microsoft Wordament (Web-based version) [15-Oct-2022]

Hints for Microsoft Wordament (Map 1)

Microsoft Wordament is a word-finding game and is a part of Microsoft Ultimate Word Games. The web-based version of Microsoft Wordament is freely available on MSN Games, and its native version is available on iOS and Android.

Hints for Web-based version

@duonghuuphuc
duonghuuphuc / conda-cheatsheet-2022.md
Last active October 17, 2022 14:56
Some popular and basic conda commands

CONDA CHEAT SHEET

This GIST presents some basic commands to work with Anaconda Terminal.

Basic commands

  • conda info --- Verify whether conda is installed, if yes, print all information about the installed conda such as Python version, conda version, env location
  • conda update conda --- Update conda to the latest version
  • conda install PACKAGENAME --- Install a package which is made available on Anaconda repository
  • pip install PACKAGENAME --- Install a package directly from PyPI
  • conda update PACKAGENAME --- Update an installed package