From bf3ca86247b6e193ff39bb14e21d46db43689ee2 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Mon, 23 Mar 2026 17:42:43 -0700 Subject: new snippets; working on mindmap/config --- config/emacs.org | 436 ++++++++++++++++++++++++++++--------------------------- config/nix.org | 37 ++--- 2 files changed, 237 insertions(+), 236 deletions(-) (limited to 'config') diff --git a/config/emacs.org b/config/emacs.org index c0e568c..29794af 100644 --- a/config/emacs.org +++ b/config/emacs.org @@ -84,6 +84,7 @@ syntax elsewhere. Generally, however, these are all unordered and not dependent (menu-bar-mode -1) (scroll-bar-mode -1) (tool-bar-mode -1) + (global-auto-revert-mode 1) ;; load theme, fonts, and transparency. Prettify symbols. (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130) @@ -263,226 +264,226 @@ of course Emacs was not designed to be fully imperative. ** Org Mode This is my org mode configuration, which also configures latex. #+begin_src emacs-lisp :tangle ../nix/init.el -(use-package org - :demand t - :after (f s dash nix-mode scheme-mode) - :hook - ((org-mode . remove-annoying-pairing)) - :custom - (org-export-allow-bind-keywords t "don't emit warnings") - (org-confirm-babel-evaluate nil "I want to evaluate stuff when publishing") - ;; Fix terrible indentation issues - (org-edit-src-content-indentation 0) - (org-src-tab-acts-natively t) - (org-src-preserve-indentation t) - - (TeX-PDF-mode t) - (org-confirm-babel-evaluate nil "Don't ask to evaluate code block") - (org-export-with-broken-links t "publish website even with broken links") - (org-src-fontify-natively t "Colors!") - - ;; org-latex - (org-format-latex-header "\\documentclass{article} \ - \\usepackage[usenames]{color} \ - [DEFAULT-PACKAGES] \ - [PACKAGES] \ - \\pagestyle{empty} % do not remove \ - % The settings below are copied from fullpage.sty \ - \\setlength{\\textwidth}{\\paperwidth} \ - \\addtolength{\\textwidth}{-3cm} \ - \\setlength{\\oddsidemargin}{1.5cm} \ - \\addtolength{\\oddsidemargin}{-2.54cm} \ - \\setlength{\\evensidemargin}{\\oddsidemargin} \ - \\setlength{\\textheight}{\\paperheight} \ - \\addtolength{\\textheight}{-\\headheight} \ - \\addtolength{\\textheight}{-\\headsep} \ - \\addtolength{\\textheight}{-\\footskip} \ - \\addtolength{\\textheight}{-3cm} \ - \\setlength{\\topmargin}{1.5cm} \ - \\addtolength{\\topmargin}{-2.54cm} \ - \\usepackage{amsmath} \ - ") - (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") - (org-latex-preview-ltxpng-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") - (org-latex-to-html-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^

//' -e 's/<\\/p>$//'" "latex to MathML with special character handling") - (org-latex-to-mathml-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^

//' -e 's/<\\/p>$//'" "latex to MathML with special character handling") - - (TeX-engine 'xetex "set xelatex as default engine") - (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex") - ;; (preview-image-type 'png "Use PNGs") - (org-preview-latex-default-process 'dvipng) - (org-format-latex-options - '(:foreground default - :background default - :scale 2 - :html-foreground "Black" - :html-background "Transparent" - :html-scale 1.5 - :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) "space latex better") - (org-return-follows-link t "be able to follow links without mouse") - (org-startup-indented t "Indent the headings") - (org-image-actual-width '(300) "Cap width") - (org-startup-with-latex-preview t "see latex previews on opening file") - (org-startup-with-inline-images t "See images on opening file") - (org-hide-emphasis-markers t "prettify org mode") - (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}") - (org-pretty-entities t "prettify org mode") - (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files") - (org-default-notes-file (concat org-directory "/notes.org") "Notes file") - - ;; ricing - (org-auto-align-tags nil) - (org-tags-column 0) - (org-catch-invisible-edits 'show-and-error) - (org-special-ctrl-a/e t) - (org-insert-heading-respect-content t) - (org-hide-emphasis-markers t) - (org-pretty-entities t) - (org-agenda-tags-column 0) - (org-ellipsis "…") - :config - (org-babel-do-load-languages 'org-babel-load-languages - '((shell . t) - (python . t) - (nix . t) - (scheme . t) - (latex . t)))) - -(use-package org-tempo - :after org) - -(use-package org-habit - :after org - :custom - (org-habit-preceding-days 7 "See org habit entries") - (org-habit-following-days 35 "See org habit entries") - (org-habit-show-habits t "See org habit entries") - (org-habit-show-habits-only-for-today nil "See org habit entries") - (org-habit-show-all-today t "Show org habit graph")) - -(use-package htmlize - :demand t - :after (catppuccin-theme doom-themes yaml-mode)) + (use-package org + :demand t + :after (f s dash nix-mode) + :hook + ((org-mode . remove-annoying-pairing)) + :custom + (org-export-allow-bind-keywords t "don't emit warnings") + (org-confirm-babel-evaluate nil "I want to evaluate stuff when publishing") + ;; Fix terrible indentation issues + (org-edit-src-content-indentation 0) + (org-src-tab-acts-natively t) + (org-src-preserve-indentation t) + + (TeX-PDF-mode t) + (org-confirm-babel-evaluate nil "Don't ask to evaluate code block") + (org-export-with-broken-links t "publish website even with broken links") + (org-src-fontify-natively t "Colors!") + + ;; org-latex + (org-format-latex-header "\\documentclass{article} \ + \\usepackage[usenames]{color} \ + [DEFAULT-PACKAGES] \ + [PACKAGES] \ + \\pagestyle{empty} % do not remove \ + % The settings below are copied from fullpage.sty \ + \\setlength{\\textwidth}{\\paperwidth} \ + \\addtolength{\\textwidth}{-3cm} \ + \\setlength{\\oddsidemargin}{1.5cm} \ + \\addtolength{\\oddsidemargin}{-2.54cm} \ + \\setlength{\\evensidemargin}{\\oddsidemargin} \ + \\setlength{\\textheight}{\\paperheight} \ + \\addtolength{\\textheight}{-\\headheight} \ + \\addtolength{\\textheight}{-\\headsep} \ + \\addtolength{\\textheight}{-\\footskip} \ + \\addtolength{\\textheight}{-3cm} \ + \\setlength{\\topmargin}{1.5cm} \ + \\addtolength{\\topmargin}{-2.54cm} \ + \\usepackage{amsmath} \ + ") + (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") + (org-latex-preview-ltxpng-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") + (org-latex-to-html-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^

//' -e 's/<\\/p>$//'" "latex to MathML with special character handling") + (org-latex-to-mathml-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^

//' -e 's/<\\/p>$//'" "latex to MathML with special character handling") + + (TeX-engine 'xetex "set xelatex as default engine") + (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex") + ;; (preview-image-type 'png "Use PNGs") + (org-preview-latex-default-process 'dvipng) + (org-format-latex-options + '(:foreground default + :background default + :scale 2 + :html-foreground "Black" + :html-background "Transparent" + :html-scale 1.5 + :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) "space latex better") + (org-return-follows-link t "be able to follow links without mouse") + (org-startup-indented t "Indent the headings") + (org-image-actual-width '(300) "Cap width") + (org-startup-with-latex-preview t "see latex previews on opening file") + (org-startup-with-inline-images t "See images on opening file") + (org-hide-emphasis-markers t "prettify org mode") + (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}") + (org-pretty-entities t "prettify org mode") + (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files") + (org-default-notes-file (concat org-directory "/notes.org") "Notes file") + + ;; ricing + (org-auto-align-tags nil) + (org-tags-column 0) + (org-catch-invisible-edits 'show-and-error) + (org-special-ctrl-a/e t) + (org-insert-heading-respect-content t) + (org-hide-emphasis-markers t) + (org-pretty-entities t) + (org-agenda-tags-column 0) + (org-ellipsis "…") + :config + (org-babel-do-load-languages 'org-babel-load-languages + '((shell . t) + (python . t) + (nix . t) + (scheme . t) + (latex . t)))) + + (use-package org-tempo + :after org) + + (use-package org-habit + :after org + :custom + (org-habit-preceding-days 7 "See org habit entries") + (org-habit-following-days 35 "See org habit entries") + (org-habit-show-habits t "See org habit entries") + (org-habit-show-habits-only-for-today nil "See org habit entries") + (org-habit-show-all-today t "Show org habit graph")) -(unless noninteractive (use-package htmlize - :after (doom-themes))) + :demand t + :after (catppuccin-theme doom-themes yaml-mode)) -(use-package ox-latex - :after (org) - :custom - (org-latex-compiler "xelatex" "Use latex as default") - (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default")) + (unless noninteractive + (use-package htmlize + :after (doom-themes))) -(use-package ox-html - :demand t - :after (org htmlize) - :custom - (org-html-htmlize-output-type 'css "allow styling from CSS file") - (org-html-with-latex 'html "let my html handler handle latex") - (org-html-mathjax-options nil "disable mathjax, use MathML") - (org-html-mathjax-template "" "disable mathjax, use MathML") - (org-html-head-include-default-style nil "use my own css for everything") - (org-html-head-include-scripts nil "use my own js for everything") - (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site") - (org-html-divs '((preamble "header" "preamble") - (content "main" "content") - (postamble "footer" "postamble")) "semantic html exports") - (org-html-viewport '((width "device-width") - (initial-scale "1.0") - (minimum-scale "1.0")) "Prevent zooming out past default size") - :config (advice-add 'org-html-latex-environment :around #'org-html-latex-environment-pandoc-fix)) - -(use-package ox-rss - :after org - :demand t) + (use-package ox-latex + :after (org) + :custom + (org-latex-compiler "xelatex" "Use latex as default") + (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default")) -(use-package ox-publish - :demand t - :after (org f s dash ox-html ox-rss) - :custom - (org-publish-project-alist - `(("website-org" - :base-directory "~/monorepo" - :base-extension "org" - :exclude "nix/README\\.org\\|blog/rss\\.org\\|result/.*\\|nix/.*" - :publishing-directory "~/website_html" - :with-author t - :with-date t - :with-broken-links t - :language en - - :recursive t - :publishing-function org-html-publish-to-html - :headline-levels 4 - :html-footnotes-section "


%s%s
" - :html-head ,(concat "\n\n\n\n\n\n\n\n\n\n\n" - "" "") - (s-replace "\n" "") - (s-replace "/*]]>*/-->" "") - (s-trim) - (minify-css)) - (f-read-text "~/monorepo/style.css" 'utf-8) - "") - :html-preamble t - :html-preamble-format (("en" "

home | section main page | rss feed


")) - - ;; sitemap.html stuff - :auto-sitemap t - :sitemap-filename "sitemap.org" - :sitemap-title "Site Index" - :sitemap-style list - :sitemap-sort-files anti-chronologically) - - ("website-blog-rss" - :base-directory "~/monorepo/blog" - :base-extension "org" - :recursive nil - :exclude "rss\\.org\\|index\\.org\\|404\\.org" - :rss-extension "xml" - - :publishing-directory "~/website_html/blog" - :publishing-function rp/org-rss-publish-to-rss - :html-link-home "https://ret2pop.net/blog/" - :html-link-use-abs-url t - - ;; use custom sitemap functionality to publish rss feed - :auto-sitemap t - :sitemap-filename "rss.org" - :sitemap-title "Blog Feed" - :sitemap-style list - :sitemap-sort-folders ignore - :sitemap-sort-files anti-chronologically - :sitemap-format-entry format-rss-feed-entry - :sitemap-function format-rss-feed) - - ("website-sitemap-xml" - :base-directory "~/monorepo" - :base-extension "org" - :recursive t - :exclude "nix/README\\.org\\|blog/rss\\.org" - :publishing-directory "~/website_html" - :publishing-function rp/org-sitemap-publish-function - :auto-sitemap t - :sitemap-filename "sitemap.xml" - :sitemap-format-entry org-sitemap-format-entry-xml - :sitemap-style list - :sitemap-function org-sitemap-format-xml) - - ("website-static" - :base-directory "~/monorepo" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg\\|txt\\|webp\\|conf" - :publishing-directory "~/website_html/" - :recursive t - :publishing-function org-publish-attachment) - - ("website" - :auto-sitemap t - :components ("website-org" "website-static" "website-blog-rss" "website-sitemap-xml"))) - "functions to publish website")) + (use-package ox-html + :demand t + :after (org htmlize) + :custom + (org-html-htmlize-output-type 'css "allow styling from CSS file") + (org-html-with-latex 'html "let my html handler handle latex") + (org-html-mathjax-options nil "disable mathjax, use MathML") + (org-html-mathjax-template "" "disable mathjax, use MathML") + (org-html-head-include-default-style nil "use my own css for everything") + (org-html-head-include-scripts nil "use my own js for everything") + (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site") + (org-html-divs '((preamble "header" "preamble") + (content "main" "content") + (postamble "footer" "postamble")) "semantic html exports") + (org-html-viewport '((width "device-width") + (initial-scale "1.0") + (minimum-scale "1.0")) "Prevent zooming out past default size") + :config (advice-add 'org-html-latex-environment :around #'org-html-latex-environment-pandoc-fix)) + + (use-package ox-rss + :after org + :demand t) + + (use-package ox-publish + :demand t + :after (org f s dash ox-html ox-rss) + :custom + (org-publish-project-alist + `(("website-org" + :base-directory "~/monorepo" + :base-extension "org" + :exclude "nix/README\\.org\\|blog/rss\\.org\\|result/.*\\|nix/.*" + :publishing-directory "~/website_html" + :with-author t + :with-date t + :with-broken-links t + :language en + + :recursive t + :publishing-function org-html-publish-to-html + :headline-levels 4 + :html-footnotes-section "

%s%s
" + :html-head ,(concat "\n\n\n\n\n\n\n\n\n\n\n" + "" "") + (s-replace "\n" "") + (s-replace "/*]]>*/-->" "") + (s-trim) + (minify-css)) + (f-read-text "~/monorepo/style.css" 'utf-8) + "") + :html-preamble t + :html-preamble-format (("en" "

home | section main page | rss feed


")) + + ;; sitemap.html stuff + :auto-sitemap t + :sitemap-filename "sitemap.org" + :sitemap-title "Site Index" + :sitemap-style list + :sitemap-sort-files anti-chronologically) + + ("website-blog-rss" + :base-directory "~/monorepo/blog" + :base-extension "org" + :recursive nil + :exclude "rss\\.org\\|index\\.org\\|404\\.org" + :rss-extension "xml" + + :publishing-directory "~/website_html/blog" + :publishing-function rp/org-rss-publish-to-rss + :html-link-home "https://ret2pop.net/blog/" + :html-link-use-abs-url t + + ;; use custom sitemap functionality to publish rss feed + :auto-sitemap t + :sitemap-filename "rss.org" + :sitemap-title "Blog Feed" + :sitemap-style list + :sitemap-sort-folders ignore + :sitemap-sort-files anti-chronologically + :sitemap-format-entry format-rss-feed-entry + :sitemap-function format-rss-feed) + + ("website-sitemap-xml" + :base-directory "~/monorepo" + :base-extension "org" + :recursive t + :exclude "nix/README\\.org\\|blog/rss\\.org" + :publishing-directory "~/website_html" + :publishing-function rp/org-sitemap-publish-function + :auto-sitemap t + :sitemap-filename "sitemap.xml" + :sitemap-format-entry org-sitemap-format-entry-xml + :sitemap-style list + :sitemap-function org-sitemap-format-xml) + + ("website-static" + :base-directory "~/monorepo" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg\\|txt\\|webp\\|conf" + :publishing-directory "~/website_html/" + :recursive t + :publishing-function org-publish-attachment) + + ("website" + :auto-sitemap t + :components ("website-org" "website-static" "website-blog-rss" "website-sitemap-xml"))) + "functions to publish website")) #+end_src As you can see, I only have one real entry in config here (I don't count requires even though they have to be on the top) @@ -556,6 +557,11 @@ Company-mode! We need this to do autocomplete stuff. #+begin_src emacs-lisp :tangle ../nix/init.el (use-package company :custom (company-backends '(company-ispell company-capf company-yasnippet company-files) "Set company backends") + :bind (:map company-active-map + ("RET" . nil) + ("" . nil) + ("tab" . company-complete-selection) + ("" . company-complete-selection)) :hook ((after-init . global-company-mode))) (use-package company-box :hook (company-mode . company-box-mode)) diff --git a/config/nix.org b/config/nix.org index 4af62f3..5690f7f 100644 --- a/config/nix.org +++ b/config/nix.org @@ -1564,25 +1564,19 @@ does not support conduit at the moment. Note that this is not fully declarative ** Ollama Use ollama for serving large language models to my other computers. #+begin_src nix :tangle ../nix/modules/ollama.nix -{ config, lib, pkgs, ... }: -{ - # services.open-webui.enable = lib.mkDefault (!config.monorepo.profiles.server.enable); - services.ollama = { - enable = lib.mkDefault config.monorepo.profiles.desktop.enable; - package = if (config.monorepo.profiles.cuda.enable) then pkgs.ollama-cuda else pkgs.ollama-vulkan; - loadModels = if (config.monorepo.profiles.cuda.enable) then [ - "qwen3:30b" - "qwen3-coder:latest" - "qwen2.5-coder:latest" - "gemma3:12b-it-qat" - ] else [ - "qwen3:0.6b" - "qwen2.5-coder:0.5b" - ]; - host = "0.0.0.0"; - openFirewall = true; - }; -} + { config, lib, pkgs, ... }: + { + # services.open-webui.enable = lib.mkDefault (!config.monorepo.profiles.server.enable); + services.ollama = { + enable = lib.mkDefault config.monorepo.profiles.desktop.enable; + package = if (config.monorepo.profiles.cuda.enable) then pkgs.ollama-cuda else pkgs.ollama-vulkan; + loadModels = if (config.monorepo.profiles.cuda.enable) then [ + ] else [ + ]; + host = "0.0.0.0"; + openFirewall = true; + }; + } #+end_src ** Bitcoind #+begin_src nix :tangle ../nix/modules/bitcoin.nix @@ -4629,6 +4623,7 @@ standard. }; shellAliases = { + ret2pop-serve = "devd -ol ~/website_html/"; clone-secrets = "git clone ssh://\"$1\"/home/preston/secrets \"$HOME/secrets\""; get-channel-id = "yt-dlp --print \"%(channel_id)s\" --playlist-end 1 \"$1\""; se = "sops edit"; @@ -4648,7 +4643,7 @@ standard. }; loginExtra = '' if [[ "$(tty)" = "/dev/tty1" ]]; then - exec Hyprland + exec start-hyprland fi ''; }; @@ -4714,7 +4709,7 @@ for these configurations. pavucontrol alsa-utils imagemagick ffmpeg helvum # Net - curl rsync gitFull ungoogled-chromium + curl rsync gitFull ungoogled-chromium devd # Tor torsocks tor-browser -- cgit v1.3