Skip to content

Instantly share code, notes, and snippets.

View douglarek's full-sized avatar
💭
Acting cool, do not disturb

douglarek

💭
Acting cool, do not disturb
View GitHub Profile
@douglarek
douglarek / the-gentle-singularity.md
Last active June 11, 2025 12:28
https://blog.samaltman.com/the-gentle-singularity Sam Altman 萨姆·奥尔特曼 《温柔的奇点》发布于 2025 年 6 月 11 日上午 5:12 使用 deepseek-v3 双语翻译

The Gentle Singularity 温柔的奇点

We are past the event horizon[^1]; the takeoff has started. Humanity is close to building digital superintelligence, and at least so far it’s much less weird than it seems like it should be. 我们已经越过了事件视界;起飞已经开始。人类即将建造出数字超级智能,至少到目前为止,它远比我们想象的要平淡无奇。

Robots are not yet walking the streets, nor are most of us talking to AI all day. People still die of disease, we still can’t easily go to space, and there is a lot about the universe we don’t understand. 机器人尚未走上街头,大多数人也没有整天与 AI 对话。人们仍会因病去世,我们仍无法轻松进入太空,宇宙中还有许多我们无法理解的事物。

And yet, we have recently built systems that are smarter than people in many ways, and are able to significantly amplify the output of people using them. The least-likely part of the work is behind us; the scientific insights that got us to systems like GPT-4 and o3 were hard-won, but will take us very far.

@douglarek
douglarek / Gentoo 使用系列之精简linux-firmware.md
Last active December 14, 2024 04:06
Gentoo 使用系列之三:精简 linux-firmware

Important

假设你定制内核(或 gentoo-kernel 通用编译)使用的是模块化而不是固件编译进内核。

本文后续将在 gentoo wiki上维护:https://wiki.gentoo.org/wiki/User:Douglarek/Streamlining_linux-firmware

书接上文[^1],相对于定制内核来说,精简 linux-firmware[^2] 还是简单很多却是收益最大的。 在 Gentoo 中,如果不把 linux-firmware 编译进内核(有许可问题),那么运行系统除了 Linux 内核之外还是需要安装这个包的, 但是这个包包含的是 Linux 目前的所有私有固件相关的二进制[^3],大小达 1.2G 之巨,但是一个桌面系统运行起来需要的也不过其中 3、5 个文件。 下面让我们来精简它。

@douglarek
douglarek / chromium-irc-chats.txt
Created November 18, 2024 08:04
这个是在 gentoo IRC 群维护者回复 Chromium 为什么会给 ~arch 用户默认升级到 beta
[2024年11月17日星期日] [GMT+8 19:51:10] <douglarek> Why does the recent update of the chromium package include beta and dev without setting them as masked? Do ~amd users have to use dev by default? https://packages.gentoo.org/packages/www-client/chromium
[2024年11月17日星期日] [GMT+8 19:52:02] <douglarek> s/dev by default/beta by default
[2024年11月17日星期日] [GMT+8 20:03:25] <sam_> ~amd64 users have always had beta exposed to them
[2024年11月17日星期日] [GMT+8 20:03:32] <sam_> dev is unkeyworded (so functionally the same as masked)
[2024年11月17日星期日] [GMT+8 20:03:33] <sam_> cc kangie
[2024年11月17日星期日] [GMT+8 20:03:43] <sam_> i.e. nothing has functionally changed
[2024年11月18日星期一] [GMT+8 00:49:40] <Kangie> douglarek_: what sam_ said. You can select the 0/stable subslot if you don't want beta
[2024年11月18日星期一] [GMT+8 10:10:29] <douglarek_> Kangie: I know I have a choice, I just don't understand why ~amd users are expected to upgrade to beta by default.
[2024年11月18日星期一] [GMT+8 10:11:13] <Kangie> because you're EXPLICITLY OPTING INTO IT
[2
@douglarek
douglarek / Gentoo 使用系列之定制内核.md
Last active December 14, 2024 07:36
Gentoo 使用系列之二:定制内核

Warning

当你开始定制内核的时候,你将会有大把时间用来浪(xué)费()。

本文后续会在 gentoo wiki 更新:https://wiki.gentoo.org/wiki/User:Douglarek/Streamlining_kernel

本文灵感来自 reddit[^0] 上一位使用 Gentoo 的老哥,根据他提供的链接一路追到了他在 Gentoo wiki 上的文章[^1],他这篇文章比较简洁,只是其中一些东西没说太清楚,而且也不太符合 Gentoo 本身的做法,另外文中的 gentoo-sources 似无必要,直接使用 Distribution Kernel[^9] 即可,这两个的唯一区别是如果你需要手动编译那么使用前者即可,如果是使用常规的 emerge 安装,并且享受系统安装带来的各种便利(如各种 portage 钩子),那么使用后者即可。

本文并不打算深入内核定制的细节(目前这方面我也是新手),主打一个清晰明了的流程走通,享受定制内核带来的编译时间的极大缩短(我的测试是大约能节省 2 倍左右的编译时间)。另外亦不介绍定制后内核的引导问题,毕竟这些无论是 Grub 还是 Systemd-boot 都有相关的 portage 钩子可做,假设你已经配置(否则需要手动处理)。

本文以 gentoo-kernel 为例(假设你当前安装的是 gentoo-kernel-bin 内核),分为以下几个步骤。

@douglarek
douglarek / Gentoo 使用系列之systemd-boot.md
Last active December 14, 2024 04:07
Gentoo 使用系列之一:使用 systemd-boot 引导

Important

当前(截止到 2024.11.24) systemd-boot[^1]:

  1. 只支持 UEFI(这可能是也是设计使然)
  2. ESP 发现只能在一个分区进行,如果你的其他系统安装在不同的 ESP 分区,则无法引导
  3. 具有相比 Grub 更少的依赖,systemd 本身就支持
  4. 对于 Gentoo 来说,并不需要手动添加内核启动项,sys-kernel/installkernel[^2] 会自动创建

本文后续将在 gentoo wiki 维护:https://wiki.gentoo.org/wiki/User:Douglarek/Use_systemd-boot

本文假设你的 ESP 分区设置在 /efi,使用的 init 系统是 systemd,当前在用的是 Grub 引导,如果不是,则需要根据实际情况修改。

@douglarek
douglarek / gentoo-package-built-time-20241112.qlog
Last active November 15, 2024 10:03
I am using an AMD Ryzen 9 3950X processor with parallel build settings (MAKEOPTS="--jobs 16 --load-average 17"). Build time statistics can be monitored using sudo qlop -vHt | pbcopy.
2024-10-29T12:51:19 >>> app-portage/cpuid2cpuflags-14: 8 seconds
2024-10-29T12:54:35 >>> x11-themes/sound-theme-freedesktop-0.8-r1: 3 seconds
2024-10-29T12:54:38 >>> media-libs/alsa-topology-conf-1.2.5.1: 3 seconds
2024-10-29T12:54:41 >>> media-libs/alsa-ucm-conf-1.2.12: 3 seconds
2024-10-29T12:54:44 >>> acct-group/pipewire-0-r2: 3 seconds
2024-10-29T12:54:47 >>> media-libs/libfreeaptx-0.1.1-r1: 7 seconds
2024-10-29T12:54:54 >>> sys-libs/zlib-1.3.1-r1: 4 seconds
2024-10-29T12:54:58 >>> dev-db/sqlite-3.46.1: 4 seconds
2024-10-29T12:55:02 >>> media-libs/alsa-lib-1.2.12: 4 seconds
2024-10-29T12:55:06 >>> media-libs/libogg-1.3.5-r1: 3 seconds
@douglarek
douglarek / mihomo-for-openwrt.md
Last active March 20, 2025 03:34
Mihomo for OpenWrt, don't use the hearse anymore! 在 OpenWrt 中运行原神,不要再使用灵车脚本啦!

Prerequisites

  • OpenWrt/ImmortalWrt 23.05+
  • Assume your routing system is arm64 architecture

NOTE Unless otherwise specified, all the following commands are executed in the router terminal.

Update: 2024-07-20 Packaged: https://github.com/douglarek/mihomo-openwrt

Install deps

package main
import (
"fmt"
"math"
"os"
"unsafe"
)
// ----------------------------------------------------------------------------
@douglarek
douglarek / a-dae-init.sh
Last active August 20, 2024 15:12
Regarding how to better use DAE in OpenWRT, use `a-dae-init.sh -> /etc/init.d/dae` and `config.dae -> /etc/dae/config.dae`. For DAE version 0.5.1 or higher, you need to install kmod-veth additionally.
#!/bin/sh /etc/rc.common
# Copyright (C) 2023 Tianling Shen <[email protected]>
USE_PROCD=1
START=99
CONF="dae"
PROG="/usr/bin/dae"
LOG_DIR="/var/log/dae"
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.output_parser import StrOutputParser
import requests
from bs4 import BeautifulSoup
from langchain.schema.runnable import RunnablePassthrough, RunnableLambda
from langchain.utilities import DuckDuckGoSearchAPIWrapper
import json
RESULTS_PER_QUESTION = 3