西维蜀黍

【IoT】安装 Home Assistant Core

Install on Raspberry Pi

# Install Software Properties Common
sudo apt install -y software-properties-common

# Add the Deadsnakes PPA
sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update; sudo apt install -y python3.12

# Update Python 3 to Point to the New Version
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.x 1
sudo update-alternatives --config python3

# verify
python3 --version

# homeassistant 2024.2.4 needs python3.12
sudo apt-get install python3.12-distutils
python3 -m pip install wheel
pip3 install homeassistant==2024.2.4

# 我出现了找不到该版本错误,2024.2.1 Requires-Python >=3.11.0
# 这时候需要升级 Python版本

ref

Install on Ubuntu

  ...


【NAS】DIY NAS

Background

RAID

  • RAID 0

    • File level writes, data duplicated on additional disks with no fault tolerance
  • RAID 1

    • Mirrored block level writes distributed across disks
  • RAID 5

    • 这个模式最少得3块以上的硬盘,属于RAID1 和 RAID0 之间,比如有4块硬盘组RIAD5,那么只会用一块硬盘进行保护,其它的空间可以叠加:
      • 空间大小:2+2+2+ 2 = 6T
    • 这个模式,可以最大的利用磁盘空间,也能保护磁盘,而且如果用SSD的话,硬盘速度也有叠加,不过缺点就是硬盘在损坏以后,换上新的硬盘后,重建数据的时间非常长,而重建过程中,如果再损坏一块硬盘,就全部玩完。
  • RAID 6

  • Block level writes distributed across disks, double distributed parity

  • RAID 10

  • 最多可以坏两个盘

    • RAID0和RAID1的结合,需要4个硬盘才行,先将2个硬盘进行RAID0,再将2个RAID0进行RAID1,可以保住数据安全的同时,提供硬盘速度。
  • RAID 6

    • 就是RAID5模式的加强版,用2个硬盘做冗余
  ...


【macOS】RTL8153 网卡驱动

查看 Type-C 网卡型号

  ...


【Design Pattern】Microservices - API Gateway / Backend for Frontend (BFF) Pattern

Context

Let’s imagine you are building an online store that uses the Microservice architecture pattern and that you are implementing the product details page. You need to develop multiple versions of the product details user interface:

  • HTML5/JavaScript-based UI for desktop and mobile browsers - HTML is generated by a server-side web application
  • Native Android and iPhone clients - these clients interact with the server via REST APIs

In addition, the online store must expose product details via a REST API for use by 3rd party applications.

A product details UI can display a lot of information about a product. For example, the Amazon.com details page for POJOs in Action displays:

  • Basic information about the book such as title, author, price, etc.
  • Your purchase history for the book
  • Availability
  • Buying options
  • Other items that are frequently bought with this book
  • Other items bought by customers who bought this book
  • Customer reviews
  • Sellers ranking

Since the online store uses the Microservice architecture pattern the product details data is spread over multiple services. For example,

  • Product Info Service - basic information about the product such as title, author
  • Pricing Service - product price
  • Order service - purchase history for product
  • Inventory service - product availability
  • Review service - customer reviews …

Consequently, the code that displays the product details needs to fetch information from all of these services.

  ...


【Engineering】Unix Philosophy

Unix philosophy

The Unix philosophy, originated by Ken Thompson, is a set of cultural norms and philosophical approaches to minimalist, modular software development. It is based on the experience of leading developers of the Unix operating system. Early Unix developers were important in bringing the concepts of modularity and reusability into software engineering practice, spawning a “software tools” movement. Over time, the leading developers of Unix (and programs that ran on it) established a set of cultural norms for developing software; these norms became as important and influential as the technology of Unix itself; this has been termed the “Unix philosophy.”

The Unix philosophy emphasizes building simple, short, clear, modular, and extensible code that can be easily maintained and repurposed by developers other than its creators. The Unix philosophy favors composability as opposed to monolithic design.

  ...