---
title: "2025-01-05"
url: "https://notes.junghanacs.com/journal/20250105T000000"
author: "Junghan Kim"
date: "2025-01-05T11:44:00+09:00"
lastmod: "2025-01-05T11:51:00+09:00"
tags: ["journal"]
description: "캠핑에서 차박하다 몸살이 난 채로, gptel의 Perplexity 인용 표시 워크어라운드 코드와 aider-gemini 페어프로그래밍 실험을 남겼다. 데이비드 브룩스의 『두 번째 산』과 아툴 가완디의 『어떻게 죽을 것인가』도 함께 담았다."
---

## 2025-01-05

&lt;2025-01-05 Sun&gt;

> (excellent_advice_for_living.t2t)
>
> cultivate 12 people who love you because they are worth more than 12 million people who like you.
>
> 나를 좋아하는 12명의 사람들은 나를 좋아하는 1,200만 명 이상의 가치가 있기 때문에 나를 좋아하는 12명을 육성하세요.

-   [ ] \#영감
-   [ ] \#원씽
-   [ ] \#가족
-   [ ] \#요약
-   [ ] \#오늘만든노트

    -   [@데이비드브룩스 #두번째삶 #관계주의 (2025-01-05)](https://notes.junghanacs.com/bib/20250105T120726)
    -   [@아툴가완디 어떻게 죽을 것인가 #유한함 (2025-01-05)](https://notes.junghanacs.com/bib/20250105T121221)

### 11:44 시작

### 11:51 며칠 앓음. 캠핑가서 차에서 자다가 탈남

## 백링크

[2025-01-05 Sun 12:20]

-   [@데이비드브룩스 #두번째삶 #관계주의 (2025-01-05)](https://notes.junghanacs.com/bib/20250105T120726)

## 지피텔

(“Perplexity: Citations · Issue \#299 · Karthink/Gptel” n.d.)

### Perplexity: citations · Issue #299 · karthink/gptel

-   First, Thank you very much for this great package! I’m (also) using perplexity. So far I successfully managed to set gptel in order to make API calls to the perplexity models. One of the nice point...
-   Perplexity

동작함

[2025-01-05 Sun 12:35]

```elisp
;;--------------------------------------------------------------------------------
;; Workaround: show citations
;;--------------------------------------------------------------------------------
(cl-defmethod gptel-curl--parse-stream ((_backend gptel-openai) _info)
  (let* ((content-strs)
         (citations-strs (or (plist-get _info :citations-strs) '()))  ;; 从 info 中获取 citations-strs
         (citations-added (plist-get _info :citations-added)))  ;; 从 info 中获取 citations-added
    (condition-case nil
        (while (re-search-forward "^data:" nil t)
          (save-match-data
            (unless (looking-at " *\\[DONE\\]")
              (let* ((response (gptel--json-read))
                     (delta (map-nested-elt
                             response '(:choices 0 :delta)))
                     (content (plist-get delta :content))
                     (citations (plist-get response :citations)))
                (push content content-strs)
                (unless citations-added
                  (when citations
                    (setq citations-strs
                          (let ((index 0))
                            (concat "Citations:\n"
                                    (mapconcat (lambda (citation)
                                                 (setq index (1+ index))
                                                 (format "[%d] %s \n" index citation))
                                               citations)
                                    "\n")))
                    (plist-put _info :citations-strs citations-strs)  ;; 更新 info 中的 citations-strs
                    (plist-put _info :citations-added t)  ;; 更新 info 中的 citations-added
                    ))
                ))))
      (error
       (goto-char (match-beginning 0))))
    (apply #'concat (append (unless citations-added
                              (list citations-strs))
                            (nreverse content-strs)
                            ))))
```

### 다른 코드 - 참고용

```elisp

(defun rdu-gptel-perplexity-insert-references (end)
  "From gptel output for Perplexity, extract citations.
gptel-log-level must be set to debug.
\"end\" is the response end position, as passed from gptel-post-response-functions.
"
  (interactive)
  (let ((pbuffer (buffer-name)))
    (switch-to-buffer "*gptel-log*")
    (end-of-buffer)
    (search-backward-regexp " \"citations\": ")
    (search-forward "[")
    (forward-char)
    (copy-region-as-kill (point) (- (search-forward "]") 1))

    (switch-to-buffer pbuffer)
    (goto-char end)
    (beginning-of-line)
    (open-line 1)
    (yank)
    (open-line 1)

    (mark-paragraph)
    (replace-string-in-region "\"," "\n")
    (replace-string-in-region " \"" "")
    (replace-string-in-region "\"" "")

    (rectangle-number-lines (+ (region-beginning) 1) (- (region-end) 1) 1 "[%d] ")
    (goto-char (region-end))
    (deactivate-mark)

    ;; From gptel-end-of-response in gptel.el, by Karthik Chikmagalur
    (when (looking-at (concat "\n\\{1,2\\}"
                              (regexp-quote
                               (gptel-prompt-prefix-string))
                              "?"))
      (goto-char (match-end 0)))))

(defun rdu-gptel-post-response-function (&optional _ end arg)
  "If Perplexity is the backend, extract and insert citations.
O.w. use gptel-end-of-response.
gptel-log-level must be set to debug."
  (interactive)
  (if (string= (slot-value gptel-backend 'name) "Perplexity")
      (rdu-gptel-perplexity-insert-references end)
    (gptel-end-of-response _ end arg)))

```

## EmacsConf 2024: Emacs 30 Highlights - Philip Kaludercic

<https://youtube.com/watch?v=V1mnDK_tuAs&si=B7jRlUHrsghqldkC>

## Emacs: sequence notes with Denote (denote-sequence.el)

[2025-01-05 Sun 12:28] <https://youtube.com/watch?v=27krzVtflQY&si=upTOLJxTQfqrigjH>

### Emacs: sequence notes with Denote (denote-sequence.el)

(Protesilaos Stavrou 2025)

## 퍼플

[2025-01-01 Wed 07:35]

### Perplexity: citations · Issue #299 · karthink/gptel :

(“Perplexity: Citations · Issue \#299 · Karthink/Gptel” n.d.)

-   First, Thank you very much for this great package! I’m (also) using perplexity. So far I successfully managed to set gptel in order to make API calls to the perplexity models. One of the nice point...



```text

  In case it helps someone else, the following function, rdu-gptel-perplexity-insert-references, inserts Perplexity's citations into the buffer. For it to work, you must set gptel-log-level to debug (the function grabs the citations from the *gptel-log* buffer). I also (add-hook 'gptel-post-response-functions 'rdu-gptel-post-response-function) so the function is called when the buffer is using a Perplexity backend (but calls gptel-end-of-response otherwise); here, I assume that the name used in gptel-make-openai (when creating the backend) is "Perplexity".

Beware: my elisp is completely rudimentary and this code is way too procedural; but it works for me.

(Side note: for reasons I don't understand, Perplexity always returns exactly five citations.)
```

```elisp

(defun rdu-gptel-perplexity-insert-references (end)
  "From gptel output for Perplexity, extract citations.
gptel-log-level must be set to debug.
\"end\" is the response end position, as passed from gptel-post-response-functions.
"
  (interactive)
  (let ((pbuffer (buffer-name)))
    (switch-to-buffer "*gptel-log*")
    (end-of-buffer)
    (search-backward-regexp " \"citations\": ")
    (search-forward "[")
    (forward-char)
    (copy-region-as-kill (point) (- (search-forward "]") 1))

    (switch-to-buffer pbuffer)
    (goto-char end)
    (beginning-of-line)
    (open-line 1)
    (yank)
    (open-line 1)

    (mark-paragraph)
    (replace-string-in-region "\"," "\n")
    (replace-string-in-region " \"" "")
    (replace-string-in-region "\"" "")

    (rectangle-number-lines (+ (region-beginning) 1) (- (region-end) 1) 1 "[%d] ")
    (goto-char (region-end))
    (deactivate-mark)

    ;; From gptel-end-of-response in gptel.el, by Karthik Chikmagalur
    (when (looking-at (concat "\n\\{1,2\\}"
                              (regexp-quote
                               (gptel-prompt-prefix-string))
                              "?"))
      (goto-char (match-end 0)))))

(defun rdu-gptel-post-response-function (&optional _ end arg)
  "If Perplexity is the backend, extract and insert citations.
O.w. use gptel-end-of-response.
gptel-log-level must be set to debug."
  (interactive)
  (if (string= (slot-value gptel-backend 'name) "Perplexity")
      (rdu-gptel-perplexity-insert-references end)
    (gptel-end-of-response _ end arg)))
```

## 링크

[2025-01-01 Wed 09:05]

### ligarto.org/rdiaz |

(Diaz-Uriarte 2017)

-   Diaz-Uriarte, Ramon

### 최고의 교실 - 서밋스쿨 맞춤형교육

(다이앤 태브너 2021)

-   다이앤 태브너 우미정 빌 게이츠
-   내 아이를 미래형 인재로 만드는 1인 맞춤형 교육“한 명 한 명에게 초점을 맞추는 교실이 가능할까?”아이들의 미래를 어떻게 준비해야 할까? 우리가 교육에 그토록 관심과 열정을 쏟는 이유가 아이들을 명문 대학에 입학시키려는 목적뿐인가? 그렇게 해서 대학 이후의 ...
-   Prepared: What kids need for fulfilled life

## GPTEL GEMINI 기본

### 실험용 모델 | Gemini API | Google AI for Developers :

(“실험용 모델 | Gemini API | Google AI for Developers” n.d.)

### ammaarreshi/Gemini-Search Perplexity style AI Search :2025

(ammaar [2025] 2025)

-   ammaar
-   Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding
-

### 생성 AI 활용기 2024: Copilot, Claude, Gemini :

(“생성 AI 활용기 2024: Copilot, Claude, Gemini” n.d.)

-   [《생성 AI 활용기》](<https://wikidocs.net/book/9451>) 책에 다루지 않았거나 업데이트된 내용을 이곳에 씁니다. 목차: 1. [앤트로픽(Ant…
-   생성 AI 활용기 2024

### Aider-AI/aider AI pair programming in your terminal :2024

(“Aider-AI/Aider AI Pair Programming in Your Terminal” [2023] 2024)

-   aider is AI pair programming in your terminal

### aider gemini

[2025-01-05 Sun 22:44]

```text
pipx inject aider-chat google-generativeai
```

```text
 pipx install google-generativeai --include-deps
⚠️  Note: normalizer was already on your PATH at /usr/bin/normalizer
⚠️  Note: tqdm was already on your PATH at /usr/bin/tqdm
  installed package google-generativeai 0.8.3, installed using Python 3.12.3
  These apps are now globally available
    - normalizer
    - pyrsa-decrypt
    - pyrsa-encrypt
    - pyrsa-keygen
    - pyrsa-priv2pub
    - pyrsa-sign
    - pyrsa-verify
    - tqdm
done! ✨ 🌟 ✨
~ via  v20.14.0 via 🐍 v3.12.3
➜
```
