#1082 转载:Android 15 提供原生 Linux 终端

2025-03-16

Android 的 Linux 终端应用现已广泛适用于 Pixel 设备,获取方法如下

你需要一部 Pixel 设备、最新的软件更新,以及几分钟的时间。

作者:Andy Walker
2025 年 3 月 7 日

TL;DR(摘要)

  • Android 的 Linux 终端应用现已广泛适用于运行 2025 年 3 月更新的 Pixel 设备。
  • 该基于 Debian 的环境允许用户随身携带完整的 Linux 实例,尽管仍缺乏一些便捷功能。

去年年底,我们曾报道过,Google 正在开发一款原生的 Linux 终端应用,使智能手机用户能够随身携带桌面级 Linux 发行版。从那时起,我们已经看到该应用随着 Android 15 测试版推送。而现在,随着 2025 年 3 月的 Pixel 更新,这款应用的稳定版本已更广泛地适用于运行最新稳定版 Android 的 Google 手机用户。

“设置” > “系统” > “开发者选项” 中启用 Linux 开发环境后,Linux 终端应用的图标会自动出现。当我激活该功能并点击图标时,系统提示我下载 567MB 的文件。

尽管我在 Pixel 8 上首次尝试运行该终端时失败了,但第二次尝试成功了。越过这个小障碍后,我便可以通过应用列表中的快捷方式打开终端,并运行诸如 helpdffree -m 等基础命令。当然,你也可以执行更高级的命令。

值得注意的是,该 Linux 环境基于 Debian,这是最成熟的 Linux 发行版之一。与原生终端应用 Termux 不同,Linux 终端应用是通过 Android 虚拟化框架(AVF) 在虚拟机中运行的。

不过,该 Linux 终端应用仍然缺少一些功能。其中最大的缺陷可能是 不支持 GUI 应用,但正如我们之前进行的《Doom》演示所示,这项功能计划在 Android 16 中推出。

对大多数用户来说,Android 上的 Linux 终端应用或许并不算特别激动人心或具有颠覆性,但对于开发者和高级用户而言,这无疑是一个巨大的进步。它使用户能够在移动设备上运行桌面级 Linux 应用,为各种需求提供便利。

#1080 读书笔记怎么写

2025-02-09

一般来说,技术类书籍每一张的内容都需要仔细阅读,每个点都需要理解,甚至通过实践来促进或加深理解。
不过,我需要阅读管理类书籍,比如《可复制的领导力》、《卓有成效的管理者》等,然后写读书笔记。

这里我对我的阅读方法和怎么写读书笔记做一个总结。

  1. 获取电子书
  2. 阅读目录,通过章节名称了解内容框架
  3. AI 总结书本大意

    请帮忙总结一下《卓有成效的管理者》这本书的核心思想、主要观点、内容结构、适用对象。
    
    1. AI 并不那么可靠,所以放在自己粗读之后,AI 总结和自己的理解相互印证。
  4. 阅读别人的读后感、阅读笔记、思维导图

  5. 快速阅读全书
    1. 观点与故事
  6. 按照自己的理解阅读重点
    1. 总结核心关键词,在书本中搜索,直接跳转到那一段阅读

#1078 转载:照明的历史

2025-01-24

工业革命之前,世界是漆黑的,灯光极其昂贵,火是唯一的人造光源。

历史上,人造光一直是富人和有权势的人的特权,生产和维护既费力又肮脏,可用性和质量都很差。穷人很难获得人造光,总是生活在黑暗中。

古代房屋在夜晚有蜡烛照明,是巨大财富的标志。当时,蜂蜡制成的优质蜡烛是最好的光源,但天然蜂蜡的供应有限,加上手工制作的繁琐,除了最富有的人之外,其他人都买不到优质蜡烛。

一位作家写道:"打开你的冰箱门,你召唤出的光线比 18 世纪大多数家庭所享受的光线总量还要多。"

后来人们发现,鲸油(鲸鱼的皮下脂肪)是更好的蜡烛材料,燃烧时发出干净、稳定的光,是工业革命早期了最好的照明,但它也非常昂贵。

捕鲸业为世界带来了照明,但也将一些鲸鱼物种推向了灭绝的边缘。仅在 1700 年至 1800 年间,为了得到鲸油,就至少有 300,000 头鲸鱼被屠杀。

1800 年代初,欧洲和美国出现了燃气照明,燃烧煤气来发光。然而,燃气照明的安装和维护费用昂贵,而且有危险。所以,煤气灯一般不用在家里,而用在工商业和大城市的路灯。

煤气灯很亮,比之前的任何灯至少亮 20 倍。使用燃气照明是人类第一次体验明亮的照明。

1846 年,天然气生产的副产品煤焦油(简称煤油)做成灯,用来照明。煤油开始取代鲸油,导致照明成本直线下降,并且燃烧时明亮、无味。

正是因为煤油,夜间第一次变得明亮了,天黑后也能生产和娱乐。

19 世纪后半期,托马斯·爱迪生(Thomas Edison)发明了电灯,电照明的时代从此来临。

#1077 Doggo DNS 工具

2025-01-18
  • https://github.com/mr-karan/doggo
  • https://doggo.mrkaran.dev/docs/

安装

$ go install github.com/mr-karan/doggo/cmd/doggo@latest
$ doggo
NAME:
  doggo 🐶 DNS Client for Humans

USAGE:
  doggo [--] [query options] [arguments...]

VERSION:
  unknown - unknown

EXAMPLES:
  doggo mrkaran.dev                             Query a domain using defaults.
  doggo mrkaran.dev CNAME                       Query for a CNAME record.
  doggo mrkaran.dev MX @9.9.9.9                 Uses a custom DNS resolver.
  doggo -q mrkaran.dev -t MX -n 1.1.1.1         Using named arguments.
  doggo mrkaran.dev --aa --ad                   Query with Authoritative Answer and Authenticated Data flags set.
  doggo mrkaran.dev --cd --do                   Query with Checking Disabled and DNSSEC OK flags set.
  doggo mrkaran.dev --gp-from Germany           Query using Globalping API from a specific location.

FREE FORM ARGUMENTS:
  Supply hostnames, query types, and classes without flags. Example:
  doggo mrkaran.dev A @1.1.1.1

TRANSPORT OPTIONS:
  Specify the protocol with a URL-type scheme.
  UDP is used if no scheme is specified.
  @udp://     eg: @1.1.1.1                                                        initiates a UDP query to 1.1.1.1:53.
  @tcp://     eg: @tcp://1.1.1.1                                                  initiates a TCP query to 1.1.1.1:53.
  @https://   eg: @https://cloudflare-dns.com/dns-query                           initiates a DOH query to Cloudflare via DoH.
  @tls://     eg: @tls://1.1.1.1                                                  initiates a DoT query to 1.1.1.1:853.
  @sdns://    initiates a DNSCrypt or DoH query using a DNS stamp.
  @quic://    initiates a DOQ query.

SUBCOMMANDS:
  completions [bash|zsh|fish]   Generate the shell completion script for the specified shell.

QUERY OPTIONS:
  -q, --query=HOSTNAME          Hostname to query the DNS records for (eg mrkaran.dev).
  -t, --type=TYPE               Type of the DNS Record (A, MX, NS etc).
  -n, --nameserver=ADDR         Address of a specific nameserver to send queries to (9.9.9.9, 8.8.8.8 etc).
  -c, --class=CLASS             Network class of the DNS record (IN, CH, HS etc).
  -x, --reverse                 Performs a DNS Lookup for an IPv4 or IPv6 address. Sets the query type and class to PTR and IN respectively.
  --any                         Query all supported DNS record types (A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT, CAA).

RESOLVER OPTIONS:
  --strategy=STRATEGY           Specify strategy to query nameserver listed in etc/resolv.conf. (all, random, first).
  --ndots=INT                   Specify ndots parameter. Takes value from /etc/resolv.conf if using the system namesever or 1 otherwise.
  --search                      Use the search list defined in resolv.conf. Defaults to true. Set --search=false to disable search list.
  --timeout=DURATION            Specify timeout for the resolver to return a response (e.g., 5s, 400ms, 1m).
  -4, --ipv4                    Use IPv4 only.
  -6, --ipv6                    Use IPv6 only.
  --tls-hostname=HOSTNAME       Provide a hostname for verification of the certificate if the provided DoT nameserver is an IP.
  --skip-hostname-verification  Skip TLS Hostname Verification in case of DOT Lookups.

QUERY FLAGS:
  --aa                          Set Authoritative Answer flag.
  --ad                          Set Authenticated Data flag.
  --cd                          Set Checking Disabled flag.
  --rd                          Set Recursion Desired flag (default: true).
  --z                           Set Z flag (reserved for future use).
  --do                          Set DNSSEC OK flag.

OUTPUT OPTIONS:
  -J, --json                    Format the output as JSON.
  --short                       Short output format. Shows only the response section.
  --color                       Defaults to true. Set --color=false to disable colored output.
  --debug                       Enable debug logging.
  --time                        Shows how long the response took from the server.

GLOBALPING OPTIONS:
  --gp-from=Germany             Query using Globalping API from a specific location.
  --gp-limit=INT                Limit the number of probes to use from Globalping.

DNS 查询

$ doggo sendcloud.net a @223.5.5.5
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
sendcloud.net.  A       IN      60s     106.75.106.173  223.5.5.5:53
sendcloud.net.  A       IN      60s     106.75.106.166  223.5.5.5:53

$ doggo sendcloud.net a @223.5.5.5 --json
{
  "responses": [
    {
      "answers": [
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN",
          "ttl": "60s",
          "address": "106.75.106.173",
          "status": "",
          "rtt": "67ms",
          "nameserver": "223.5.5.5:53"
        },
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN",
          "ttl": "60s",
          "address": "106.75.106.166",
          "status": "",
          "rtt": "67ms",
          "nameserver": "223.5.5.5:53"
        }
      ],
      "authorities": null,
      "questions": [
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN"
        }
      ]
    }
  ]
}

$ doggo sendcloud.net a @223.5.5.5 --json | jq ".responses[].answers[].address"
"106.75.106.166"
"106.75.106.173"

查反解

$ doggo --reverse 101.44.172.1 @223.5.5.5
NAME                            TYPE    CLASS   TTL     ADDRESS                         NAMESERVER
1.172.44.101.in-addr.arpa.      PTR     IN      300s    hwsg1c1.email.engagelab.com.    223.5.5.5:53

$ doggo hwsg1c1.email.engagelab.com. a @223.5.5.5
NAME                            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
hwsg1c1.email.engagelab.com.    A       IN      600s    101.44.172.1    223.5.5.5:53

Global Ping

$ doggo markjour.com --gp-from Germany,Japan --gp-limit 2
LOCATION                        NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
Falkenstein, DE, EU, Hetzner
Online GmbH (AS24940)
                                markjour.com.   A       IN      600s    121.42.82.115   private
Osaka, JP, AS, Oracle
Corporation (AS31898)
                                markjour.com.   A       IN      600s    121.42.82.115   8.8.8.8

#1076 Docker 轻量基础镜像:scratch、Distroless、Alpine 与 Debian Slim

2025-01-10

在 Docker 镜像构建中,基础镜像决定了应用的运行环境,也直接影响镜像体积、安全性、兼容性和后期维护成本。
很多开发者在追求轻量化时,首先会想到 Alpine。但实际上,scratch、Distroless、Alpine 和 Debian Slim 分别代表了不同的设计思路,并不存在绝对最优的方案。
选择基础镜像的核心,不是单纯追求体积最小,而是在运行依赖、安全性和可维护性之间取得平衡。

#1074 多格式转 Markdown 工具:MarkItDown

2025-01-05
-> % pipx install "markitdown[all]"
  installed package markitdown 0.1.5, installed using Python 3.14.4
  These apps are now available
    - markitdown
done! ✨ 🌟 ✨

MarkItDown 是微软开发的 Python 工具,用于将 Office 文档或者 PDF 文件转换为 Markdown 格式。

markitdown path-to-file.pdf > document.md
markitdown path-to-file.pdf -o document.md
cat path-to-file.pdf | markitdown
from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("test.xlsx")
print(result.text_content)
from markitdown import MarkItDown
from openai import OpenAI

client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
result = md.convert("example.jpg")
print(result.text_content)

帮助文档:

-> % markitdown --help
usage: SYNTAX:

    markitdown <OPTIONAL: FILENAME>
    If FILENAME is empty, markitdown reads from stdin.

EXAMPLE:

    markitdown example.pdf

    OR

    cat example.pdf | markitdown

    OR

    markitdown < example.pdf

    OR to save to a file use

    markitdown example.pdf -o example.md

    OR

    markitdown example.pdf > example.md

Convert various file formats to markdown.

positional arguments:
  filename

options:
  -h, --help            show this help message and exit
  -v, --version         show the version number and exit
  -o, --output OUTPUT   Output file name. If not provided, output is written to stdout.
  -x, --extension EXTENSION
                        Provide a hint about the file extension (e.g., when reading from stdin).
  -m, --mime-type MIME_TYPE
                        Provide a hint about the file's MIME type.
  -c, --charset CHARSET
                        Provide a hint about the file's charset (e.g., UTF-8).
  -d, --use-docintel    Use Document Intelligence to extract text instead of offline conversion. Requires a valid Document Intelligence Endpoint.
  --use-cu, --use-content-understanding
                        Use Azure Content Understanding to extract text. Requires --cu-endpoint.
  -e, --endpoint ENDPOINT
                        Document Intelligence Endpoint. Required if using Document Intelligence.
  --cu-endpoint CU_ENDPOINT
                        Content Understanding Endpoint. Required if using --use-cu.
  --cu-analyzer CU_ANALYZER
                        Content Understanding analyzer ID. If not specified, auto-selects by file type.
  --cu-file-types CU_FILE_TYPES
                        Comma-separated list of file types to route to Content Understanding (e.g., pdf,jpeg,mp4). If omitted, all supported types are routed.
  -p, --use-plugins     Use 3rd-party plugins to convert files. Use --list-plugins to see installed plugins.
  --list-plugins        List installed 3rd-party plugins. Plugins are loaded when using the -p or --use-plugin option.
  --keep-data-uris      Keep data URIs (like base64-encoded images) in the output. By default, data URIs are truncated.

#1073 Mac 实用工具

2025-01-05

Useful built-in macOS command-line utilities
https://weiyen.net/articles/useful-macos-cmd-line-utilities/

通过命令行获取密码:

security find-internet-password -s "https://example.com"

打开文件:

open /path/to/file

复制粘贴:

pbcopy < file.txt
pbpaste > file.txt

echo "Hello, world!" | pbcopy;

pbpaste
>> Hello, world!

网络测速:

networkQuality  # Note the capital "Q"!

防止 Mac 休眠:

caffeinate
caffeinate -u -t 3600

生成 UUID:

uuidgen
uuidgen | tr '[:upper:]' '[:lower:]' | pbcopy

朗读文本:

say "Hello, world!"