doom emacs安装

安装 Doom Emacs 的步骤如下:

  1. 安装 Emacs: 确保你已经安装了 Emacs 26.1 或更高版本。你可以通过包管理器安装,例如在 Ubuntu 上:

    1
    sudo apt-get install emacs

  2. 安装 Git: Doom Emacs 依赖 Git 来管理配置。确保你已经安装了 Git:

    1
    sudo apt-get install git

  3. 克隆 Doom Emacs: 打开终端并运行以下命令来克隆 Doom Emacs 仓库:

    1
    git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d

  4. 安装 Doom Emacs: 运行 Doom Emacs 的安装脚本:

    1
    ~/.emacs.d/bin/doom install

  5. 配置 Doom Emacs: 安装完成后,你可以通过编辑 ~/.doom.d/init.el~/.doom.d/config.el 文件来配置 Doom Emacs。

  6. 启动 Doom Emacs: 运行 emacs 命令启动 Doom Emacs。

如果你遇到任何问题,可以参考 Doom Emacs 的官方文档或社区支持。

doom sync来同步一些package,更新等。

1
doom sync

gptel配置

要在 Doom Emacs 中配置 gptel(一个用于与 GPT 模型交互的 Emacs 包),你可以按照以下步骤进行:

  1. 安装 gptel: 在 Doom Emacs 中,你可以通过编辑 ~/.doom.d/packages.el 文件来添加 gptel 包。打开该文件并在 package! 部分添加以下内容:

    1
    (package! gptel)

  2. 配置 gptel: 编辑 ~/.doom.d/config.el 文件,添加 gptel 的配置。你可以设置 API 密钥和其他选项:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    (use-package! gptel
    :config
    (setq! gptel-api-key "your key"))
    ;; OPTIONAL configuration
    (setq gptel-model "deepseek-chat"
    gptel-backend
    (gptel-make-openai "DeepSeek" ;Any name you want
    :host "api.deepseek.com"
    :endpoint "/chat/completions"
    :stream t
    :key "your key" ;can be a function that returns the key
    :models '("deepseek-chat" "deepseek-coder")))
    ;; 方便hexo来渲染latex公式
    (defun replace-latex-delimiters (arg1 arg2)
    "Replace LaTeX delimiters \(, \), \[, and \] with $, $$, respectively."
    (interactive)
    (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "\\\\(" nil t)
    (replace-match "$" nil nil))
    (goto-char (point-min))
    (while (re-search-forward "\\\\)" nil t)
    (replace-match "$" nil nil))
    (goto-char (point-min))
    (while (re-search-forward "\\\\\\[" nil t)
    (replace-match "$$" nil nil))
    (goto-char (point-min))
    (while (re-search-forward "\\\\\\]" nil t)
    (replace-match "$$" nil nil))))

    (defun replace-dollar-spaces (arg1 arg2)
    "Replace '$ ' and ' $' with '$' in the current buffer."
    (interactive)
    (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "\\(?:^\\| \\)\\$\\(?: \\|$\\)" nil t)
    (replace-match "$" nil nil))))

    (defun replace-and-trim-latex (arg1 arg2)
    (progn
    (replace-latex-delimiters arg1 arg2)
    (replace-dollar-spaces arg1 arg2)))

    (add-hook 'gptel-post-response-functions 'replace-and-trim-latex)

  3. 同步 Doom Emacs: 运行以下命令来同步 Doom Emacs 配置并安装 gptel 包:

    1
    ~/.emacs.d/bin/doom sync

  4. 使用 gptel: 安装完成后,你可以在 Emacs 中使用 gptel 命令与 GPT 模型交互。例如,运行 M-x gptel 来启动交互会话。

请确保你已经获取了 OpenAI 的 API 密钥,并将其替换到 gptel-api-key 配置中。这样,你就可以在 Doom Emacs 中使用 gptel 与 GPT 模型进行交互了。

上面的内容基本就是来自gptel和deepseek后端。

果果的打字实践

中秋快乐

下面是果果promt的作文。

中秋节快到了,我要和爷爷奶奶去安吉玩。

中秋节去安吉是个好主意!安吉以竹海和茶园闻名,景色宜人。可以考虑去竹博园、龙王山、天荒坪等地游玩。别忘了品尝当地的白茶和竹笋美食。祝你们玩得开心,中秋快乐!

写一篇相关的作文。

中秋安吉行

中秋佳节将至,金风送爽,丹桂飘香。在这个团圆的日子里,我决定和爷爷奶奶一同前往安吉,感受大自然的宁静与美丽。

安吉,素有“中国竹乡”之称,这里的竹海如同一幅翠绿的画卷,随风摇曳,发出沙沙的声响,仿佛在欢迎我们的到来。我们首先来到了竹博园,园内竹影婆娑,种类繁多,令人目不暇接。爷爷奶奶漫步其中,脸上洋溢着幸福的笑容,仿佛回到了年轻时的田园生活。

随后,我们驱车前往龙王山,这里山清水秀,空气清新。沿着蜿蜒的山路,我们登上了山顶,俯瞰整个安吉,远处的茶园如同绿色的海洋,层层叠叠,美不胜收。爷爷奶奶坐在山顶的凉亭里,品着清香的白茶,聊着家常,享受着这份难得的宁静与惬意。

夜幕降临,我们回到了住处,一轮明月高悬天际,洒下银色的光辉。爷爷奶奶在院子里摆上了月饼和水果,我们围坐在一起,赏月、聊天,感受着中秋的温馨与团圆。

这次安吉之行,不仅让我领略了大自然的美丽,更让我感受到了与爷爷奶奶共度的珍贵时光。中秋节,不仅是团圆的节日,更是感恩的时刻。愿我们每个人都能珍惜与家人相聚的时光,共度美好时光。

中秋安吉行,美景与亲情同在,愿这份美好永存心间。

妹妹今年两次由于鼻病毒引发喘,住院两次,后面如何调理,加强哪方面的锻炼

带病创作

妹妹由于鼻病毒引发喘息,住院两次,说明她的免疫系统和呼吸系统较为脆弱。以下是一些调理和锻炼建议:

调理建议:

  1. 增强免疫力
    • 均衡饮食:多摄入富含维生素C、E和锌的食物,如新鲜水果、蔬菜、坚果和全谷物。
    • 充足睡眠:保证每天8-10小时的优质睡眠。
    • 补充益生菌:适当补充益生菌,帮助维持肠道健康,增强免疫力。
  2. 呼吸系统调理
    • 避免过敏原:尽量避免接触尘螨、花粉、宠物毛发等常见过敏原。
    • 保持室内空气清新:定期开窗通风,使用空气净化器。
    • 适当使用加湿器:保持室内湿度在40-60%,有助于缓解呼吸道不适。

锻炼建议:

  1. 适度运动
    • 有氧运动:如散步、慢跑、游泳等,增强心肺功能。
    • 呼吸训练:学习深呼吸和腹式呼吸,增强肺活量。
  2. 避免剧烈运动
    • 避免剧烈运动和长时间高强度运动,以免加重呼吸负担。
  3. 循序渐进
    • 从轻度运动开始,逐渐增加运动量和强度,避免突然增加运动量导致不适。

其他建议:

  1. 定期体检:定期进行体检,监测呼吸系统和免疫系统的健康状况。
  2. 遵医嘱:如有需要,遵医嘱使用药物或进行其他治疗。

通过以上调理和锻炼,可以帮助妹妹增强免疫力和呼吸系统的健康,减少喘息发作的频率和严重程度。

C919

尽管如此,还是祝大家中秋快乐!我们的国产大飞机,后面会经常乘坐。

C919
C919餐食

夏天即将结束,带着小朋友最后玩一次水了。这是第二次去筏头派出所,距离58公里,驾车约45分钟。

老样子,吃好🥣,买一杯☕️。一路高速就到了。

不太妙的发现大桥下的水都干了,但是没有关系,找到了一个小水坑,那边还有潺潺流水。把两把椅子放好,开始看

MIT 18.02,一边看,一边品味着流水,flux,curl,div,优美。

小鱼爸爸爱学习

小朋友们的快乐很简单,只要有水玩就好啦。

可可玩水
果果特写
姐妹俩

玩好之后,🚗出来的一个路口,有两家饭店都还可以,吃点鱼头,本鸡,都是挺不错的。好啦,夏天,拜拜~

问了gpt几个适合孩子打字的网站,选择了typing club,看起来娱乐性不错,打算让果果试一试。主要培养孩子如下几点:

  1. 认识比本的字母,英文的基础
  2. 通过打字接触到计算机的一个外设,对计算机能有初步认识
  3. 打字是编辑的基础,编辑是coding的基础
  4. 打字也是使用工具的基础
  5. 等能够打字了,可以学习数学相关的工具,比如maple learn和mathematica,gpt告诉我maple learn更适合孩子,等后面可以试一试

前几天网站的图片遭到了不法分子的攻击,怪我没有安全防范意识,bucket还是用公有读,配置COS Referer白名单即可。

果果的打字练习第一课

Motivation

The LLM model is to big to put into the device, if there any batter architecture to make the model small enough to put to the device and keep the precision and inference performance.

The LLM model embedding the word to very high dimension, in order to do better classification. But it will affected by the curse of dimensionality. So we need deep neural net work(more parameters) and more training data to avoid overfitting.

Also use attention mechanism to make them classifiable.

But each time put some words into the space, may be adding one new dimension only useful for related words, and for most other words will add one no useful dimension. And the whole vector space is sparse and need more training data and complex model(more parameters).

We can use the idea of mixture of experts, they form one graph, and some experts are independent, but some has relations between each other, can be connected by edges. So the problem becomes make each experts' dimension as small as possible, and the duplication features in different experts as small as possible. We convert one high dimension sparse LLM to many row dimension dense experts. Just like the symbol table design in compiler, we can use one big flatten symbol table, but the scope level and scope name in each scope are same and can be eliminated, so traditional implementation of the symbol table use the chain of scopes hash table, make a more compact memory.

Design

A graph to represent the model, is all experts, and is the edge of the two experts.

Partitioning

Take the compute system as the whole world. We can split experts to

  • operating system
  • database
  • compiler
  • programming language
  • distributed
  • network
  • micro architecture
  • application
  • electronic
  • common knowledge

Once a word file system coming, will be both added to operating system and databse, and if a word computer arrived, it will be put to the common knowledge. And all experts depend on the common knowledge.

Evolve

All the experts can be version controlled, and can evolve, refactoring. Like add more words, add dimension, remove words to other experts, extract more experts. Just like the package manage system, all experts are packages.

Query(inference)

The query convert to tokens, and send to the related experts, exploit method use dependent experts to combine the results, exploare method to query other experts to find results too. The results contian all the experts, the sub graph forms a path. The path can be cached.

Online learning

Support real time input sentences. The tokenizer first to classification, and put to different experts, batch will trigger insert. Insert data to the experts, and update the path.

During the period 1904 to1947, the vacuum tube was the electronic device of interest and development. In 1904, the vacuum-tube diode was introduced by J. A. Fleming. Shortly thereafter, in 1906, Lee De Forest added a third element, called the control grid, to the vacuum diode, resulting in the first amplifier, the triode. In the following years, radio and television provided great stimulation to the tube industry. Production rose from about 1 million tubes in 1922 to about 100 million in 1937. In the early 1930s the four- element tetrode and the five-element pentode gained prominence in the electron-tube industry. In the years to follow, the industry became one of primary importance, and rapid advances were made in design, manufacturing techniques, high-power and high-frequency applications, and miniaturization.

三极管的发明,和工业界的需求有密切联系。radio and television provided great stimulation to the tube industry. 看现在的AI需求,对于新计算机体系结构也会有新的需求,比如memory system的演进,可能会有比较革命性的变革,比如pim。

On December 23, 1947, however, the electronics industry was to experience the advent of a completely new direction of interest and development. It was on the afternoon of this day that Dr. S. William Shockley, Walter H. Brattain, and John Bardeen demonstrated the amplifying action of the first transistor at the Bell Telephone Laboratories. The original transistor (a point-contact transistor) is shown in Fig. 2. The advantages of this three-terminal solid-state device over the tube were immediately obvious: It was smaller and lightweight; it had no heater requirement or heater loss; it had a rugged construction; it was more efficient since less power was absorbed by the device itself; it was instantly available for use, requiring no warm-up period; and lower operating voltages were possible. Note that this chapter is our first discussion of devices with three or more terminals. You will find that all amplifiers (devices that increase the voltage, current, or power level) have at least three terminals, with one controlling the flow or potential between the other two.

The first transistor

为什么这些创新都是来自美国,Bell实验室,中国到现在为止,始终没有这样原创性的工作,抄永远是跟在别人屁股后面的。这个原型满足了一些基本特性需求:

  • smaller and lightweight
  • it had no heater requirement or heater loss
  • it had a rugged construction
  • it was more efficient since less power was absorbed by the device itself
  • it was instantly available for use, requiring no warm-up period;
  • and lower operating voltages were possible

在研发过程中,应该是有这些目标牵引进行设计探索的。所以从底层原理出发,解决工业界比较强烈的需求,可以做出一些原创性的事情。

The circuit consists of a resistor in series with the voltage source connected to the inverting input of the OpAmp. The non-inverting input of the OpAmp is short circuited to ground(common). A resistor is connected to the output and provides a negative feedback path to the inverting input terminal.

inverting opamp and Since is connected to the common or ground terminal, Node 1 is said to be a virtual ground due to the virtual short circuit between the inverting and non-inverting terminals (which is grounded) as defined by the voltage constraints, The node voltage method of analysis is applied at node 1, By appling Equation , obtained from the virtual short circuit, and the constraint on the current as defined in Equation, Equation is simplified to Solving for the voltage gain, , Notice that the voltage gain is dependent only on the ratio of the resistors external to the OpAmp, and . The amplifier increases the amplitude of the input signal by this ratio. The negative sign in the voltage gain indicates an inversion in the signal.

The output voltage is also constrained by the supply voltages and , Using Equation , the maximum resistor ratio for a given input voltage is

实验

根据下图,计算增益和。如果,输出是多少?多大的输入电压幅值,会造成amplifier饱和?

inverting opamp example

Solution:

The output voltage is independent of the load resistor, , because of the low output resistance of the OpAmp. Therefore, the gain of amplifier is Using KCL at node a, The currents and are and Solving for yields, For and input voltage signal of 由于我使用的是模块,具体参考双电源供电

要计算amplifier的linear region,输入幅值需要小于,

一些实验结果

总体效果

big picture

输入

黄色为输入,左下角一个格子为1v,而蓝色一个格子为5v。

liner op region

输入为2v左右导致输出饱和

发现输出的顶部已经不再是正弦波。和理论计算比较一致。

saturation

运算放大器需要类似的双电源供电。由于只有一个单通道的直流电压源,所以需要做一个双电源供电模块。

diff voltage

所需要的元件:

  1. 单通道电压源
  2. LM324N
  3. 47K电阻两个
  4. 1电容一个100电容两个
实现

参考文章:

https://blog.csdn.net/qq_41836400/article/details/98345011

修改include/apue.h

include/apue.h增加

1
#include <sys/sysmacros.h>

修改stdio/buf.c

打开apue.3e/stdio/buf.c,搜索_LP64,大致在(文件的89~93行),将其删除

1
2
3
4
5
#ifdef _LP64
#define _flag __pad[4]
#define _ptr __pad[1]
#define _base __pad[2]
#endif

is_unbuffered, is_linebufferedbuffer_size替换如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
int
is_unbuffered(FILE *fp)
{
return(fp->_flags & _IONBF);
}

int
is_linebuffered(FILE *fp)
{
return(fp->_flags & _IOLBF);
}

int
buffer_size(FILE *fp)
{
#ifdef _LP64
return(fp->_IO_buf_end - fp->_IO_buf_base);
#else
return(BUFSIZ); /* just a guess */
#endif
}

#else

#error unknown stdio implementation!

#endif

copy头文件和库

1
2
sudo cp ./include/apue.h /usr/include/
sudo cp ./lib/libapue.a /usr/lib/

oh-my-tmux

1
2
3
4
cd
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .

add lines at the end of ~/.tmux.conf.local

1
2
3
4
5
6
7
8
9
10
11
12
13
	# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
set -g status-keys vi
set -g mode-keys vi

# replace C-b by C-a instead of using both prefixes
set -gu prefix2
unbind C-a
unbind C-b
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
set -g prefix M-o
bind M-o send-prefix

install zsh and oh-my-zsh

add 185.199.108.133 raw.githubusercontent.com t o/etc/hosts

1
2
3
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s $(which zsh)

install nodejs

install nvm

1
2
3
4
5
6
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.zshrc
nvm list-remote
nvm install v20.8.0
node -v

npm源

1
npm config set registry https://registry.npmmirror.com

install hexo and pandoc

1
2
npm install -g hexo-cli
sudo apt install pandoc

install hexo-theme-next

1
2
cd blog
npm install hexo-theme-next

theme-next patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --git a/_config.yml b/_config.yml
index 5059e2e..e4daac4 100644
--- a/_config.yml
+++ b/_config.yml
@@ -40,8 +40,8 @@ custom_file_path:
# ---------------------------------------------------------------

favicon:
- small: /images/favicon-16x16-next.png
- medium: /images/favicon-32x32-next.png
+ small: /images/favicon-16x16.png
+ medium: /images/favicon-32x32.png
apple_touch_icon: /images/apple-touch-icon-next.png
safari_pinned_tab: /images/logo.svg
#android_manifest: /images/manifest.json
@@ -164,9 +164,9 @@ sidebar:
# Sidebar Avatar
avatar:
# Replace the default image and set the url here.
- url: #/images/avatar.gif
+ url: /images/maru.jpeg
# If true, the avatar will be dispalyed in circle.
- rounded: false
+ rounded: true
# If true, the avatar will be rotated with the cursor.
rotated: false

@@ -501,7 +501,7 @@ math:

# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
- enable: false
+ enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

@@ -712,7 +712,7 @@ firestore:
# Show Views / Visitors of the website / page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi
busuanzi_count:
- enable: false
+ enable: true
total_visitors: true
total_visitors_icon: user
total_views: true
@@ -812,9 +812,11 @@ pdf:

# Mermaid tag
mermaid:
- enable: false
+ enable: true
# Available themes: default | dark | forest | neutral
- theme: forest
+ theme:
+ light: default
+ dark: dark


# ---------------------------------------------------------------
@@ -894,6 +896,7 @@ vendors:
# MathJax
# mathjax: //cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
mathjax:
+ enable: true

# KaTeX
# katex: //cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css
diff --git a/layout/_partials/footer.swig b/layout/_partials/footer.swig
index f60ea9b..dc5f8e9 100644
--- a/layout/_partials/footer.swig
+++ b/layout/_partials/footer.swig
@@ -42,6 +42,12 @@
{%- endif %}
</div>

+<div class=BbeiAn-info">
+ {{ __('<E6><B5><99>ICP<E5><A4><87>') }} -
+ <a href="http://www.miitbeian.gov.cn/">20003462<E5><8F><B7></a>
+ </a>
+</div>
+
{%- if theme.footer.powered %}
<div class="powered-by">
{%- set next_site = 'https://theme-next.org' %}

下载emacs 29.1

  • gi t clone的方式,需要autogen一下

install dependencies

树莓派源

cat /etc/apt/sources.list

1
2
deb http://mirrors.aliyun.com/raspbian/raspbian/ bullseye  main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ bullseye main non-free contrib rpi

安装emacs依赖

1
sudo apt install libxpm-dev libgif-dev libgnutls28-dev libgtk-3-dev libjpeg-dev libtiff-dev libncurses-dev libgccjit-10-dev

编译

1
2
3
./configure --with-native-compilation
make -j
sudo make install
0%