Amo Chen

Introduction to a Handy Python Package - structlog

When starting with Python’s logging module, many of us have encountered confusion, as with the following code example:

import logging

log = logging.getLogger(__name__)
log.info('Hello')

We might expect this code to print the string Hello, but it doesn’t.

This is because the default log level for Python’s logging module is WARNING, so only messages at WARNING, ERROR, or CRITICAL levels are displayed.

To properly use the logging module, setting it up is necessary, which often means consulting the Python documentation. This isn’t a problem with Python per se, but rather a design philosophy difference.

So, is there a package more intuitive and easier to use than the built-in logging module?

The answer is “yes,” and that is the structlog package, which this article introduces.

Posted on  Aug 30, 2023  in  Python Module/Package Recommendations , Python Programming - Beginner Level  by  Amo Chen  ‐ 4 min read

Introduction to the Python Package - JMESPath (A JSON Query Language Similar to jq)

JMESPath is a Python package with functions similar to jq, enabling Python developers to query and restructure JSON data with a syntax akin to jq. This is done by converting JSON into Python’s native data types using the json module. Proper use of JMESPath can simplify code and enhance readability.

This article will introduce the methods for using JMESPath.

Posted on  Jul 12, 2023  in  Python Module/Package Recommendations  by  Amo Chen  ‐ 5 min read

Great Article Share - Automating Kubernetes Deployments using Python

The article, “Automating Kubernetes Deployments using Python,” introduces how to automate the control of K8s-related resources using the Python Kubernetes package. It covers five major resources: Deployment, Service, ConfigMap, Secret, and Ingress. These are typically encountered when deploying applications to K8s. If you’re looking to automate the process of deploying applications to K8s with Python, this article is a great starting point and very valuable as a reference. Automating Deployment of Applications using Kubernetes Python SDK

Posted on  Jul 8, 2023  by  Amo Chen  ‐ 1 min read

A Conversational Guide to ULID (Universally Unique Alphabetically Sortable Identifier)

Previously, many people have been using UUIDs to ensure unique Id fields. However, the randomness of UUIDs makes them non-sortable. For example, you might generate a UUID starting with 47 one second, and then the next second it starts with 36. This randomness can lead to efficiency problems in databases like MySQL, which need to update multiple pages, especially when dealing with large amounts of data. Because of this issue, the concept of ULID was introduced.

Posted on  Jul 5, 2023  by  Amo Chen  ‐ 2 min read

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