Skip to content

Instantly share code, notes, and snippets.

View joeywang's full-sized avatar

Joey Wang joeywang

  • reallyenglish.com
  • London
View GitHub Profile

lesson Screenshot 2024-08-19 at 19 00 44

mobile phones@2x-486451a8b83055b9cafe4c45878cc7b3a7ddde5de69d5e7f53984a3c7976b408

Screenshot 2024-08-19 at 19 05 52

Container Security with Fine-Grained Permission Control

In the modern landscape of software development, containerization has become a pivotal technology for deploying and managing applications. Containers provide a lightweight, consistent environment for applications, but they also introduce new security challenges. One of the key aspects of container security is controlling permissions to ensure that only authorized users and processes can access the necessary resources. In this article, we will explore how to implement fine-grained permission control in containers, using Kubernetes as an example.

Understanding Permission Symbols

Linux file permissions are a crucial part of securing access to files and directories. Permissions are typically represented in both symbolic and octal formats. Here's a breakdown of the symbolic representation:

-rw-r-x---

Google Cloud Container Credential Rotation: A Comprehensive Guide

In the dynamic world of cloud security, regularly managing and rotating credentials is crucial for maintaining the integrity and security of your Kubernetes clusters. Google Cloud Platform (GCP) offers a robust mechanism for credential rotation in its Kubernetes Engine, a feature that is indispensable for upholding the security of your cloud infrastructure.

Why Rotate Credentials?

Credentials, such as passwords and API keys, can become compromised over time. By periodically rotating these credentials, you minimize the risk of unauthorized access and data breaches.

Prerequisites

How to Debug React Applications

Debugging React applications can be a complex task, but with the right tools and techniques, you can streamline the process and quickly identify and fix issues. In this article, we'll explore various methods to debug both React web and React Native applications.

Debugging with React Developer Tools

Chrome Extension

React Developer Tools is an invaluable tool for inspecting React components, editing props and state, and identifying performance problems.

Rack: The Swiss Army Knife of Ruby Web Servers

What is Rack?

Rack provides a minimal, modular, and adaptable interface for developing web applications in Ruby. It serves as a standard interface between web servers and web applications, allowing developers to use different web servers and frameworks seamlessly.

Rack App

To run an app service with Rack, you can use the rackup command, which is a powerful tool for starting web services. Here's how you can implement a simple web service:

Soft Delete Solutions: Discard or ActAsParanoid?

What is Soft Delete and Why It is Used a Lot

Soft delete, also known as logical delete, is a data management strategy that allows for the preservation of data in a database while marking it as "deleted" to the application. This is achieved by adding a flag or timestamp column (such as deleted_at or is_deleted) to the database table. When a record is soft deleted, it is not actually removed from the database; instead, it is hidden from regular queries but can still be accessed and restored if necessary.

Soft delete is widely used for several reasons:

  1. Data Recovery: It allows for the recovery of data in case of accidental deletion or if the information needs to be reinstated.
  2. Audit Trails: It helps maintain a history of changes for compliance and auditing purposes, providing a clear record of when data was "deleted" and potentially by whom.
@joeywang
joeywang / audit.md
Created September 23, 2024 21:43
Auditing in Database Applications: Ensuring Data Integrity and Compliance

Auditing in Database Applications: Ensuring Data Integrity and Compliance

In today's data-driven world, maintaining the integrity and security of information stored in databases is paramount. One crucial aspect of this is auditing - the practice of tracking and logging all changes made to data within a system. This article explores the importance of auditing in database applications and compares several popular auditing solutions.

Why Auditing Matters

Implementing a robust auditing system in your database application offers several key benefits:

  1. Compliance: Many industries are legally required to maintain an audit trail of changes to sensitive data.
  2. Security: Audit logs help detect unauthorized access or potential data breaches.
@joeywang
joeywang / unscope.md
Last active April 22, 2026 04:50
The Power of Unscope in Ruby on Rails

The Power of Unscope in Ruby on Rails

In Ruby on Rails, scopes are a convenient way to encapsulate common query patterns, making it easier to write clean and reusable code. However, there are times when you might need to deviate from these patterns, and that's where the unscope method comes in.

Understanding unscope

The unscope method allows you to selectively remove certain scopes from your ActiveRecord queries. This can be useful when you need to perform a query that doesn't conform to your usual patterns or when you need to override a default scope.

Default Scope Example

How to Set Up Debug Servers in Production

In the world of software development, the ability to debug issues in a production-like environment is crucial. However, routing debug traffic to specific servers without affecting regular users can be challenging. This article explores various methods to set up debug servers in production environments, focusing on Kubernetes and cloud solutions.

Kubernetes Solutions

Kubernetes offers several ways to route debug traffic to specific pods. We'll explore three methods: using Ingress, special domains, and HTTP headers.

1. Using Ingress

@joeywang
joeywang / react-16-to-17.md
Created October 4, 2024 23:43
Comprehensive Guide: Upgrading React from 16 to 17

Comprehensive Guide: Upgrading React from 16 to 17

React 17 brought several changes that, while not introducing many new features, laid the groundwork for future improvements. This guide will walk you through the process of upgrading your React application from version 16 to 17, covering package updates, testing modifications, and common issues you might encounter.

1. Upgrade Helper

Before diving into the upgrade process, it's worth mentioning the React Native Upgrade Helper:

React Native Upgrade Helper