joe 2 yıl önce
ebeveyn
işleme
78ce19cb31

+ 98 - 0
content/middleware/emacs.md

@@ -0,0 +1,98 @@
+---
+title: "Emacs"
+date: 2023-10-11T14:10:48+07:00
+draft: true
+---
+
+- `C-v` view previous page
+- `M-v` view next page
+- `C-l` Clear screen and redisplay all the text
+- `C-p` Prev line
+- `C-n` Next line
+- `C-b` Backward a character
+- `C-f` Forward a character
+- `M-b` Backward a word
+- `M-f` Forward a word
+- `C-a` Beginning of line
+- `C-e` End of line
+- `M-a` Beginning of sentence
+- `M-e` End of sentence
+- `M-<` Beginning of the whole text
+- `M->` End of the whole text
+- `C-u 8 C-n` Move to next 8th lines
+> `C-u 8 C-v` Move scrollbar by 8 lines
+> `C-u 8 *` Input ********
+- `C-g` Stop a command / Cancel a numeric argument
+> `C-u 100 C-g C-f` Move forward only 1 word
+
+## Windows
+
+- `C-x 1` One window (kill all other windows)
+
+## Editing
+
+- `<DEL>(backspace)` Delete the character before the cursor
+- `C-d` Delete the next character after the cursor
+- `M-<Del>` Kill the word immediately before the cursor
+- `M-d` Kill the next word after the cursor
+- `C-k` Kill from the cursor position to the end of line
+- `M-k` Kill to the end of the current sentence
+- `C-<Space>` Mark set
+- `C-w` Kill text starting from `C-<Space>`
+- `C-y` yank the last killed text back
+- `M-y` repaces "last killed text" with the previous kill
+- `C-/` undo
+> `C-_` the same.
+> `C-x u` the same
+
+## Files
+
+- `C-x C-f` Find a file
+> Cancel the command with `C-g`
+- `C-x C-s` Save the file
+
+## Buffers
+
+- `C-x C-f` Switch between opened files
+- `C-x C-b` List buffers
+- `C-x b` Switch between buffers
+- `C-x s` Save some buffers
+
+## Extending The Command Set
+
+- `C-x` Character eXtend
+- `M-x` Named command eXtend
+- `C-x C-c` End the emacs session
+- `C-z` Suspends emacs
+> `fg` `%emacs` to resume
+- `C-x u` undo
+- `C-x f 20` set margin
+- `M-x` Execute a command
+> `M-x replace-string` replace string
+> `M-x recover-this-file` recover current file
+> `M-x fundamental-mode`
+> `M-x text-mode` switch major mode
+- `M-q` re-fill the paragraph
+
+## Searching
+
+- `C-s` forward search
+- `C-r` reverse search
+- `C-g` quit searching
+
+## Windows
+
+- `C-x 2` split the screen into 2 windows
+- `C-M-v` scroll the other window
+- `C-x o` move cursor to the other window
+
+## Frames
+
+- `C-x 5 2` New frame
+- `C-x 5 0` Close frame
+
+## Help
+
+- `C-h ?` All help
+> `F1` or `M-x help` instead
+- `C-h m` Current major mode document

+ 51 - 0
content/posts/http_based_notifications.md

@@ -0,0 +1,51 @@
+---
+title: "HTTP based notification"
+date: 2023-10-12T15:13:50+07:00
+draft: true
+---
+
+## 问题描述
+
+在常见的 REST API 中,有时会需要服务端“主动”通知客户端某个 event 的发生或信息产生变更,这时候会想到用 websocket
+实现,但 websocket 会产生比较大的服务端开销。
+
+## 解决思路
+
+传统的做法为客户端定时请求特定接口,在有数据的时候处理
+
+## 其他思路
+
+一般的 REST 协议都会采用统一的格式,比如
+
+```json
+{
+	"code": 0,
+	"data": {
+
+	}
+}
+```
+
+*code 表示错误码,data 表示协议数据*
+
+如果服务端设计为,任何对用户数据变更的跟踪以及新的 event 的跟踪都汇集起来,在用户有任意最新的请求的时候检查某标记,
+模拟实时推送的效果。在多数服务端 API 框架中,这可以作为一个 router 的 middleware 来实现。新的协议如下
+
+```json
+{
+	"code": 0,
+	"data": {
+
+	},
+	"notify": {
+		"type": "sys",
+		"data": {
+
+		}
+	}
+}
+```
+
+*event 作为可选字段,客户端检查如果为 null / empty / undefined 则表示没有任何事件*
+
+客户端需要解析出 notify 数据后保存在 store 中,在需要的页面显示出来即可。

+ 2 - 0
content/res/docs_or_books.md

@@ -52,3 +52,5 @@ draft: false
 
 - [Build your own Lisp](https://buildyourownlisp.com/)
 > using C
+- [ANSI Common Lisp 中文](https://acl.readthedocs.io/en/latest/index.html)
+> 简繁