Dev Operations

写在前面 本篇博客主要会记录和总结一些我平时在 Unix 环境下遇到的一些问题,包括但不局限于命令行,Git 操作等 CommandLine 可执行文件存放位置 如果我有一个可执行文件,我应该把它放在哪里 /usr/local/bin 最推荐的位置 所有用户都可访问 该目录默认在 PATH 中 适合系统级的第三方软件 $HOME/.local/bin 用户级安装的推荐位置 只对当前用户可用 需要确保该目录在 PATH 中 要将文件复制到 /usr/local/bin,使用: ...

November 25, 2024 · 10 min · KKKZOZ

Mac Development Environment Setup

How to install Homebrew? 参考资料 homebrew 软件仓库和 homebrew bottles 软件仓库有什么不一样 homebrew 仓库类型主要有两种,它们用途不同: homebrew 软件仓库(brew git remote) 包含所有软件包的安装脚本(Ruby 格式的 Formula) 主要仓库是 homebrew-core 仓库相对较小,包含的是软件包的描述文件 homebrew bottles 软件仓库 存放预编译的二进制软件包 类似于 Linux 下的 .deb 或 .rpm 包 仓库较大,因为包含实际的软件二进制文件 使用 bottles 可以避免从源码编译,加快安装速度 举例说明: 当你运行 brew install wget 时: Homebrew 先从软件仓库获取 wget 的 Formula 然后检查 bottles 仓库是否有对应的预编译包 如果有 bottle 就直接下载安装,否则就按照 Formula 的指示编译源码 所以设置镜像时通常需要同时配置这两种仓库: 配置软件仓库以获取安装脚本,同时配置 bottles 仓库来获取预编译包 安装步骤 前置条件 在终端中执行 xcode-select --install 设置环境变量 首先设置环境变量,方便使用国内镜像进行安装 export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" export HOMEBREW_INSTALL_FROM_API=1 安装 Homebrew /bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)" 设置镜像 # 将下面这段内容添加到 ~/.zshrc 中 export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api" export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles" 完整流程是: ...

November 21, 2024 · 3 min · KKKZOZ

A Piece Of: Logs

Log Levels Log levels for software applications have a rich history dating back to the 1980s. One of the earliest and most influential logging solutions for Unix systems, Syslog, introduced a range of severity levels, which provided the first standardized framework for categorizing log entries based on their impact or urgency. The following are the levels defined by Syslog in descending order of severity: Emergency (emerg): indicates that the system is unusable and requires immediate attention. Alert (alert): indicates that immediate action is necessary to resolve a critical issue. Critical (crit): signifies critical conditions in the program that demand intervention to prevent system failure. Error (error): indicates error conditions that impair some operation but are less severe than critical situations. Warning (warn): signifies potential issues that may lead to errors or unexpected behavior in the future if not addressed. Notice (notice): applies to normal but significant conditions that may require monitoring. Informational (info): includes messages that provide a record of the normal operation of the system. Debug (debug): intended for logging detailed information about the system for debugging purposes. The specific log levels available to you may defer depending on the programming language, logging framework, or service in use. However, in most cases, you can expect to encounter levels such as FATAL, ERROR, WARN, INFO, DEBUG, and TRACE. ...

May 13, 2024 · 5 min · KKKZOZ

Note: WSL2 Mirrored 网络模式下异常情况总结

Background 前段时间看到了 Windows Subsystem for Linux September 2023 update - Windows Command Line 这篇文章后,发现了 WSL 2 的新网络模式挺有意思的: Networking improvements are a consistent top ask for WSL, and this feature aims to improve the networking experience in WSL! This is a complete overhaul on the traditional NAT networking architecture of WSL, to an entirely new networking mode called “Mirrored”. The goal of this mode is to mirror the network interfaces that you have on Windows into Linux, to add new networking features and improve compatibility. ...

November 25, 2023 · 3 min · KKKZOZ