Skip to content

Instantly share code, notes, and snippets.

View duonghuuphuc's full-sized avatar

Duong Huu Phuc duonghuuphuc

View GitHub Profile
@duonghuuphuc
duonghuuphuc / install-python3-on-macos-10.15-and-later.md
Last active May 23, 2024 16:04
Install Python3 on macOS 10.15 and later

Install Python3 on macOS 10.15 and later

This tutorial will show you how to install Python3 on a macOS system. To demonstrate the installation process, I will present the steps on macOS Catalina (Version 10.15). Instead of installing Python3 via the installer from the Python website, this tutorial will use brew which is the most popular Package Manager for macOS.

1/ Install brew

Installing brew on your system is straightforward, you just need to copy-and-paste the following command to the Terminal:

@duonghuuphuc
duonghuuphuc / install-virtualenvwrapper-on-macos-10.15-and-later.md
Created June 12, 2022 08:12
Install virtualenvwrapper on macOS 10.15 and later

Install virtualenvwrapper on macOS 10.15 and later

At WWDC 2019 on June 3, 2019, starting with macOS Catalina (10.15), the macOS will use zsh as default shell across the operating system. Besides, Bash is still available along with the new zsh; however, by setting zsh as the default shell, Apple does force you to move to the new platform.

virtualenvwrapper is a set of extensions to the original virtualenv which is a tool for creating isolated virtual Python environments. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies. According to the virtualenvwrapper docs, there are some noteworthy features such as:

  • Organizes all your virtual environments in one place.
  • Wrappers for managing your virtual environments (create, delete, copy).
  • Use a single command to switch between environments.
@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
@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 / 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 / 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.

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