Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

Elisp

:ID: DA2E158A-A67A-494D-92B0-6D84311B7FB8

# Debugging

# Viewing backtraces

Turn on debugging with M-x toggle-debug-on-error will open a buffer on error showing a backtrace.

# edebug

# puts debugging

Put stuff to message buffer

(message "debug: %s" foo)

# JSON

# Encoding an object

(json-encode
 `(("model" . "gpt-3.5-turbo")
   ("messages" . ((("role" . "user") ("content" . "foo bar foo"))))
   ("max_tokens" . "500")
   ("temperature" . 0)))
{"model":"gpt-3.5-turbo","messages":[{"role":"user","content":"foo bar foo"}],"max_tokens":"500","temperature":0}

# Parsing JSON

(defun parse-json (json-string)
  (let ((json-object (json-read-from-string json-string)))
    (cdr (assoc 'data json-object))))
(parse-json "{\"data\":1}")
1

Search Results