Amo Chen

Guide to GPU Programming

Nowadays, many AI models or machine learning models rely on GPUs for training. This is because GPUs have more cores compared to CPUs, allowing them to distribute tasks across multiple cores for parallel processing. Thus, GPUs play an increasingly important role in the AI era (should have invested in Nvidia earlier 😭). p.s. CPUs can perform a wider variety of tasks than GPUs, so they are still necessary and valuable.

Posted on  Jun 22, 2023  by  Amo Chen  ‐ 1 min read

ChatGPT Prompt Engineering for Developers Starts Now!

ChatGPT Prompt Engineering for Developers is a ’limited-time free’ course launched by AI industry leader Andrew Ng and OpenAI. It teaches developers how to integrate OpenAI’s LLM into your applications, such as for tasks like text summarization, sentiment analysis, translation, and grammar correction. However, the focus of the course isn’t on coding but on how to craft effective prompts. After all, having well-written prompts is key to ensuring the desired functionalities work accurately and effectively.

Posted on  Apr 28, 2023  by  Amo Chen  ‐ 1 min read

8 Simple Examples to Help You Write More Concise TypeScript

The following article provides 8 examples of TypeScript code snippets before and after modification, showing us how to write more concise TypeScript. However, since TypeScript is actually a superset of JavaScript, some of these concepts are also applicable to JavaScript: Clean Code in TypeScript

Posted on  Apr 23, 2023  by  Amo Chen  ‐ 1 min read

What? You Haven't Used K8s Yet?

With the rise of containerization, more and more companies are adopting Kubernetes (or K8s) to run various containerized services within K8s clusters. Not only does this provide a standard approach for deployments (since everyone writes YAML configuration files to describe how services are deployed), it also offers more flexibility in system resource scheduling and scaling (using K8s commands makes it easy to adjust the number or resources of service containers). So usually, after learning Docker and docker-compose, the next step is to learn how to use K8s.

Posted on  Mar 30, 2023  by  Amo Chen  ‐ 1 min read

Python Module Tutorial - dataclasses

Python’s dataclasses is a new module added in Python 3.7, mainly used to define structured data in the form of classes.

The dataclasses module provides some convenient features to help automatically generate commonly used class methods such as __init__, __repr__, __eq__, etc., saving developers time in writing repetitive code.

Using dataclasses can make Python programs more concise and improve code readability.

Are you ready to show off your skills using dataclasses in your Python code?

Posted on  Feb 1, 2023  in  Python Programming - Intermediate Level  by  Amo Chen  ‐ 8 min read

How to Use the Built-in VNC Client on macOS

Sometimes for work, you might need to connect to a remote server’s desktop using VNC (Virtual Network Computing) to view its display. Often, this means installing tools like TeamViewer, TightVNC, or VNC Viewer.

However, macOS actually has a built-in VNC client that you can use. If you require a simple VNC client for work, you can use the built-in VNC client on macOS.

Posted on  Dec 25, 2022  in  macOS  by  Amo Chen  ‐ 1 min read

Designed for Counting - Python Counter Class

The Python collections module provides several convenient classes for developers to use, among which the Counter class (a subclass of dict) can be applied in counting-related scenarios:

A Counter is a dict subclass for counting hashable objects.

This article will introduce the usage of the Counter class and compare its performance with dict and defaultdict.

Posted on  Apr 19, 2022  in  Python Programming - Beginner Level  by  Amo Chen  ‐ 5 min read

Practical Python Performance Profiling - From cProfile to py-spy

It’s a well-known fact that Python applications run slower compared to those written in languages like Go or C. However, Python’s ease of use significantly speeds up development, and its philosophy of batteries included along with its rich ecosystem can greatly reduce the need to reinvent the wheel, shortening the path from concept to product.

The issue of slower execution can be mitigated through various techniques such as using distributed systems, multithreading, multiprocessing, optimizing algorithms, or extending Python with more efficient languages (e.g., using the ctypes module). Although it might not achieve the same high efficiency as Go or C, it can certainly reach an acceptable level of performance.

Before tackling real efficiency issues, it’s often the case that inefficiencies are due to poorly written Python applications rather than limitations of Python itself.

Analyzing Python code to find hidden performance issues is crucial. This article starts by introducing the cProfile module and demonstrates with examples how to identify bottlenecks in Python programs. We then use the py-spy tool to precisely locate issues, improving the efficiency of finding problems.

Posted on  Dec 9, 2021  in  Python Programming - Advanced Level  by  Amo Chen  ‐ 6 min read