1.1--- a/.hgignore Tue Nov 07 19:50:15 2023 -0500
1.2+++ b/.hgignore Thu Nov 09 00:19:21 2023 -0500
1.3@@ -1,5 +1,6 @@
1.4 .*Cargo.lock$
1.5 .*target/.*
1.6+.*system-index.txt$
1.7 .*[.]fasl$
1.8 .*[.]o$
1.9 .*[.]so$
2.1--- a/emacs/default.el Tue Nov 07 19:50:15 2023 -0500
2.2+++ b/emacs/default.el Thu Nov 09 00:19:21 2023 -0500
2.3@@ -25,7 +25,7 @@
2.4 ;; NOTE 2023-11-04: you need to add the following lines to ~/.gnupg/gpg-agent.conf:
2.5 ;; allow-emacs-pinentry
2.6 ;; allow-loopback-pinentry
2.7- ;; epg-pinentry-mode 'loopback
2.8+ epg-pinentry-mode 'loopback
2.9 shr-use-colors nil
2.10 shr-use-fonts nil
2.11 shr-max-image-proportion 0.6
2.12@@ -46,13 +46,6 @@
2.13 view-read-only t)
2.14
2.15 ;;; Variables
2.16-(defvar default-theme 'leuven-dark)
2.17-
2.18-(defvar company-domain "compiler.company")
2.19-(defvar company-name "The Compiler Company, LLC")
2.20-(defvar company-vc-domain "vc.compiler.company")
2.21-(defvar company-home "the.compiler.company")
2.22-
2.23 (defvar user-custom-file (expand-file-name (format "%s.el" user-login-name) user-emacs-directory))
2.24 (defvar user-home-directory (expand-file-name "~"))
2.25 (defvar user-lab-directory (expand-file-name "lab" user-home-directory))
2.26@@ -62,6 +55,13 @@
2.27 (defvar user-mail-directory (expand-file-name "mail" user-home-directory))
2.28 (defvar user-media-directory (expand-file-name "media" user-home-directory))
2.29
2.30+(defvar default-theme 'leuven-dark)
2.31+(defvar company-source-directory (join-paths user-lab-directory "comp"))
2.32+(defvar company-domain "compiler.company")
2.33+(defvar company-name "The Compiler Company, LLC")
2.34+(defvar company-vc-domain "vc.compiler.company")
2.35+(defvar company-home "the.compiler.company")
2.36+
2.37 ;;; Theme
2.38 (defun load-default-theme () (interactive) (load-theme default-theme))
2.39
2.40@@ -451,7 +451,7 @@
2.41 (lambda ()
2.42 (eshell/alias "d" "dired $1")
2.43 (eshell/alias "ff" "find-file $1")
2.44- (eshell/alias "hgfe" "~/bin/sh/hg-fast-export.sh")))
2.45+ (eshell/alias "hgfe" "hg-fast-export.sh")))
2.46
2.47 (defun eshell/clear ()
2.48 "Clear the eshell buffer."
2.49@@ -524,7 +524,9 @@
2.50 ("b" "bug" entry (file "inbox.org") "* FIX %?\n- _review_\n- _fix_\n- _test_" :prepend t)
2.51 ("r" "research" entry (file "inbox.org") "* RESEARCH %?\n:notes:\n:end:\n- _refs_" :prepend t)))
2.52 (setq org-html-htmlize-output-type 'css
2.53- org-html-head-include-default-style nil)
2.54+ org-html-head-include-default-style nil
2.55+ ;; comp2 default
2.56+ org-ascii-text-width 80)
2.57
2.58 (org-crypt-use-before-save-magic)
2.59
3.1--- a/emacs/ellis.el Tue Nov 07 19:50:15 2023 -0500
3.2+++ b/emacs/ellis.el Thu Nov 09 00:19:21 2023 -0500
3.3@@ -23,14 +23,37 @@
3.4 ;; config file. Feel free to rip.
3.5
3.6 ;;; Code:
3.7-(setopt default-theme 'modus-vivendi-tinted)
3.8+(setopt default-theme 'modus-vivendi-tinted
3.9+ company-source-directory (join-paths user-home-directory "dev/comp"))
3.10+
3.11+(defvar emacs-config-source (join-paths company-source-directory "core/emacs"))
3.12+
3.13+(defun edit-emacs-config (&optional src)
3.14+ (interactive (list current-prefix-arg))
3.15+ (let ((file (if src
3.16+ (expand-file-name "default.el" emacs-config-source)
3.17+ user-custom-file)))
3.18+ (find-file file)))
3.19+
3.20+(keymap-set user-map "e c" #'edit-emacs-config)
3.21
3.22 (add-hook 'lisp-mode-hook #'enable-paredit-mode)
3.23 (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
3.24 (repeat-mode)
3.25
3.26+(defun remember-project ()
3.27+ (interactive)
3.28+ (project-remember-project (project-current))
3.29+ project--list)
3.30+
3.31+(defun remember-lab-projects ()
3.32+ (interactive)
3.33+ (project-remember-projects-under user-lab-directory t))
3.34+
3.35 (keymap-global-set "C-<tab>" #'hippie-expand)
3.36 (keymap-set minibuffer-local-map "C-<tab>" #'hippie-expand)
3.37+(keymap-set user-map "p r" #'remember-project)
3.38+(keymap-set user-map "p s" #'remember-lab-projects)
3.39
3.40 (require 'sk)
3.41
3.42@@ -47,16 +70,31 @@
3.43
3.44 (use-package notmuch
3.45 :ensure t
3.46- :custom
3.47+ :init
3.48 ;; notmuch-init-file "~/.notmuch-config"
3.49- mail-user-agent 'message-user-agent
3.50- smtpmail-smtp-server "smtp.gmail.com"
3.51- message-send-mail-function 'message-smtpmail-send-it
3.52- smtpmail-debug-info t
3.53- message-default-mail-headers "Cc: \nBcc: \n"
3.54- message-kill-buffer-on-exit t
3.55- user-mail-address "ellis@rwest.io"
3.56- user-full-name "Richard Westhaver"
3.57+ (setopt
3.58+ mail-user-agent 'message-user-agent
3.59+ smtpmail-smtp-server "smtp.gmail.com"
3.60+ message-send-mail-function 'message-smtpmail-send-it
3.61+ smtpmail-debug-info t
3.62+ message-default-mail-headers "Cc: \nBcc: \n"
3.63+ message-kill-buffer-on-exit t
3.64+ user-mail-address "ellis@rwest.io"
3.65+ user-full-name "Richard Westhaver"
3.66+ notmuch-hello-sections '(notmuch-hello-insert-saved-searches
3.67+ notmuch-hello-insert-search
3.68+ notmuch-hello-insert-recent-searches
3.69+ notmuch-hello-insert-alltags)
3.70+ notmuch-show-logo nil
3.71+ notmuch-search-oldest-first nil
3.72+ notmuch-hello-hide-tags '("kill")
3.73+ notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i")
3.74+ (:name "unread" :query "tag:unread" :key "u")
3.75+ (:name "new" :query "tag:new" :key "n")
3.76+ (:name "sent" :query "tag:sent" :key "e")
3.77+ (:name "drafts" :query "tag:draft" :key "d")
3.78+ (:name "all mail" :query "*" :key "a")
3.79+ (:name "todo" :query "tag:todo" :key "t")))
3.80 :config
3.81 ;;;###autoload
3.82 (defun notmuch-exec-offlineimap ()
3.83@@ -71,8 +109,29 @@
3.84 (let* ((netrc (netrc-parse (expand-file-name "~/.netrc.gpg")))
3.85 (hostentry (netrc-machine netrc host port port)))
3.86 (when hostentry (netrc-get hostentry "password"))))
3.87+
3.88+ (defun mark-as-read ()
3.89+ "mark message as read."
3.90+ (interactive)
3.91+ (notmuch-search-tag '("-new" "-unread" "-inbox")))
3.92+
3.93+ (defun mark-as-todo ()
3.94+ "mark message as todo."
3.95+ (interactive)
3.96+ (mark-as-read)
3.97+ (notmuch-search-tag '("-new" "-unread" "-inbox" "+todo")))
3.98+
3.99+ (defun mark-as-spam ()
3.100+ "mark message as spam."
3.101+ (interactive)
3.102+ (mark-as-read)
3.103+ (notmuch-search-tag (list "+spam")))
3.104+
3.105 (keymap-set user-map "e m" #'notmuch)
3.106- (keymap-set user-map "e M" #'notmuch-exec-offlineimap))
3.107+ (keymap-set user-map "e M" #'notmuch-exec-offlineimap)
3.108+ (keymap-set notmuch-search-mode-map "S" #'mark-as-spam)
3.109+ (keymap-set notmuch-search-mode-map "R" #'mark-as-read)
3.110+ (keymap-set notmuch-search-mode-map "T" #'mark-as-todo))
3.111
3.112 (use-package elfeed :ensure t
3.113 :custom
3.114@@ -128,6 +187,24 @@
3.115 '("#+begin_src " p n>
3.116 "#+end_src" n>)
3.117 "org:src"))
3.118+;;; Org Config
3.119+;; populate org-babel
3.120+(org-babel-do-load-languages
3.121+ ;; TODO 2021-10-24: bqn, apl, k
3.122+ 'org-babel-load-languages '((shell . t)
3.123+ (emacs-lisp . t)
3.124+ (lisp . t)
3.125+ (org . t)
3.126+ (eshell . t)
3.127+ (sed . t)
3.128+ (awk . t)
3.129+ (dot . t)
3.130+ (js . t)
3.131+ (C . t)
3.132+ (python . t)
3.133+ (lua . t)
3.134+ (lilypond . t)))
3.135+
3.136
3.137 (provide 'ellis)
3.138 ;;; ellis.el ends here
4.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2+++ b/lisp/app/cli/skel.lisp Thu Nov 09 00:19:21 2023 -0500
4.3@@ -0,0 +1,130 @@
4.4+;;; Code:
4.5+(defpackage :cli/skel
4.6+ (:use :cl :std :skel :skel/core/vc :skel/core/virt :skel/comp/make)
4.7+ (:import-from :sb-posix :getcwd)
4.8+ (:import-from :uiop :println)
4.9+ (:export :main))
4.10+
4.11+(in-package :cli/skel)
4.12+
4.13+;; HACK 2023-10-14: a bit too early to implement this, would rather
4.14+;; use the repl. they're useful for linking up with the debugger tho.
4.15+(defvar skc-file-prompt-history '(""))
4.16+(make-prompt! skc-file "file")
4.17+(defvar skc-name-prompt-history '(""))
4.18+(make-prompt! skc-name "name")
4.19+
4.20+(defopt skc-help (print-help $cli))
4.21+(defopt skc-version (print-version $cli))
4.22+(defopt skc-debug (setq *log-level* (if $val :debug nil)))
4.23+;; TODO 2023-10-13: almost there
4.24+(defopt skc-config (init-skel-user-config (parse-file-opt $val)))
4.25+
4.26+(defcmd skc-init
4.27+ (let ((file (when $args (pop $args)))
4.28+ (name (if (> $argc 1) (pop $args))))
4.29+ (handler-bind
4.30+ ((sb-ext:file-exists
4.31+ #'(lambda (s)
4.32+ (println (format nil "file already exists: ~A" (or file *default-skelfile*)))
4.33+ (let ((f2 (skc-file-prompt)))
4.34+ (if (string= f2 "")
4.35+ (error s)
4.36+ (use-value f2 s))))))
4.37+ (init-skelfile file name))))
4.38+
4.39+(defcmd skc-describe
4.40+ (describe
4.41+ (find-skelfile
4.42+ (if $args (pathname (car $args))
4.43+ #P".")
4.44+ :load t)))
4.45+
4.46+(defcmd skc-inspect
4.47+ (inspect
4.48+ (find-skelfile
4.49+ (if $args (pathname (car $args))
4.50+ #P".")
4.51+ :load t)))
4.52+
4.53+(defcmd skc-show
4.54+ (find-skelfile
4.55+ (if $args (pathname (car $args))
4.56+ #P".")
4.57+ :load t))
4.58+
4.59+(defcmd skc-push
4.60+ (case
4.61+ (sk-vc
4.62+ (find-skelfile
4.63+ (if $args (pathname (car $args))
4.64+ #P".")
4.65+ :load t))
4.66+ (:hg (run-hg-command "push"))))
4.67+
4.68+(defcmd skc-make
4.69+ (if $args
4.70+ (debug! (sk-rules (find-skelfile (car $args) :load t)))
4.71+ (debug! (sk-rules (find-skelfile #P"." :load t)))))
4.72+
4.73+(define-cli $cli
4.74+ :name "skel"
4.75+ :version "0.1.1"
4.76+ :description "A hacker's project compiler and build tool."
4.77+ :thunk skc-describe
4.78+ :opts (make-opts
4.79+ (:name help :global t :description "print this message"
4.80+ :thunk skc-help)
4.81+ (:name version :global t :description "print version"
4.82+ :thunk skc-version)
4.83+ (:name debug :global t :description "set log level (debug,info,trace,warn)"
4.84+ :thunk skc-debug)
4.85+ (:name config :global t :description "set a custom skel user config" :kind file
4.86+ :thunk skc-config) ;; :kind?
4.87+ (:name input :description "input source" :kind string)
4.88+ (:name output :description "output target" :kind string))
4.89+ :cmds (make-cmds
4.90+ (:name init
4.91+ :description "initialize a skelfile in the current directory"
4.92+ :opts (make-opts (:name name :description "project name" :kind string))
4.93+ :thunk skc-init)
4.94+ (:name show
4.95+ :description "describe the project skelfile"
4.96+ :opts (make-opts (:name file :description "path to skelfile" :kind file))
4.97+ :thunk skc-describe)
4.98+ (:name inspect
4.99+ :description "inspect the project skelfile"
4.100+ :opts (make-opts (:name file :description "path to skelfile" :kind file))
4.101+ :thunk skc-inspect)
4.102+ (:name make
4.103+ :description "build project targets"
4.104+ :opts (make-opts (:name target :description "target to build" :kind string))
4.105+ :thunk skc-make)
4.106+ (:name run
4.107+ :description "run a script or command")
4.108+ (:name push
4.109+ :description "push the current project upstream"
4.110+ :thunk skc-push)
4.111+ (:name pull
4.112+ :description "pull the current project from remote")
4.113+ (:name clone
4.114+ :description "clone a remote project")
4.115+ (:name commit
4.116+ :description "commit changes to the project vc")
4.117+ (:name edit
4.118+ :description "edit a project file")
4.119+ (:name shell
4.120+ :description "open the sk-shell interpreter")))
4.121+
4.122+(defun run ()
4.123+ (let ((*log-level* nil)
4.124+ (*skel-user-config* (init-skel-user-config)))
4.125+ (in-readtable *macs-readtable*) ;; should be in sxp
4.126+ (with-cli () $cli
4.127+ (do-cmd $cli)
4.128+ (debug-opts $cli)
4.129+ (dbg! *skel-user-config*))))
4.130+
4.131+(defmain ()
4.132+ (run)
4.133+ (sb-ext:exit :code 0))
5.1--- a/readme.org Tue Nov 07 19:50:15 2023 -0500
5.2+++ b/readme.org Thu Nov 09 00:19:21 2023 -0500
5.3@@ -24,10 +24,11 @@
5.4
5.5 * rust
5.6 ** sys
5.7+These crates contain FFI bindings to foreign libraries, usually in C.
5.8 *** btrfs
5.9 *** btrfsutil
5.10 ** lib
5.11-*** alch
5.12+*** TODO alch
5.13 *** audio
5.14 #+begin_src shell :dir rust/lib/audio :results output replace :exports results
5.15 cargo test
5.16@@ -38,7 +39,7 @@
5.17 running 1 test
5.18 test default_device ... ok
5.19
5.20-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
5.21+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
5.22
5.23
5.24 running 0 tests
5.25@@ -47,7 +48,35 @@
5.26
5.27 #+end_example
5.28 *** crypto
5.29-*** db
5.30+#+begin_src shell :dir rust/lib/crypto :results output replace :exports results
5.31+cargo test
5.32+#+end_src
5.33+#+RESULTS:
5.34+#+begin_example
5.35+
5.36+running 6 tests
5.37+test tests::salsa20_key0_iv1 ... ok
5.38+test tests::salsa20_key0_ivhi ... ok
5.39+test tests::salsa20_key1_iv0 ... ok
5.40+test tests::xsalsa20_encrypt_hello_world ... ok
5.41+test tests::xsalsa20_encrypt_zeros ... ok
5.42+test tests::gen_keypair ... ok
5.43+
5.44+test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
5.45+
5.46+
5.47+running 0 tests
5.48+
5.49+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
5.50+
5.51+#+end_example
5.52+*** TODO db
5.53+#+begin_src shell :dir rust/lib/db :results output replace :exports results :eval no
5.54+cargo test
5.55+#+end_src
5.56+
5.57+#+RESULTS:
5.58+
5.59 *** flate
5.60 #+begin_src shell :dir rust/lib/flate :results output replace :exports results
5.61 cargo test
5.62@@ -58,7 +87,7 @@
5.63 running 1 test
5.64 test pack_test ... ok
5.65
5.66-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s
5.67+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
5.68
5.69
5.70 running 0 tests
6.1--- a/rust/lib/crypto/Cargo.toml Tue Nov 07 19:50:15 2023 -0500
6.2+++ b/rust/lib/crypto/Cargo.toml Thu Nov 09 00:19:21 2023 -0500
6.3@@ -11,8 +11,6 @@
6.4 [dependencies]
6.5 salsa20 = { version = "0.8.1", features = ["xsalsa20"] }
6.6 hex = "*"
6.7-ed25519 = "*"
6.8+# ed25519 = "*"
6.9 ed25519-dalek = "1.0.1"
6.10-hash = { version = "0.1.0", path = "../hash" }
6.11-
6.12-[dev-dependencies]
6.13+hash = { version = "0.1.0", path = "../hash" }
6.14\ No newline at end of file
7.1--- a/rust/lib/crypto/src/lib.rs Tue Nov 07 19:50:15 2023 -0500
7.2+++ b/rust/lib/crypto/src/lib.rs Thu Nov 09 00:19:21 2023 -0500
7.3@@ -7,7 +7,7 @@
7.4 use con::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH};
7.5
7.6 pub use salsa20::{self, XSalsa20};
7.7-//use ed25519::signature::Signature as _;
7.8+// use ed25519::signature::Signature as _;
7.9 use ed25519_dalek::*;
7.10 use hex::FromHex;
7.11
8.1--- a/rust/lib/krypt/Cargo.toml Tue Nov 07 19:50:15 2023 -0500
8.2+++ b/rust/lib/krypt/Cargo.toml Thu Nov 09 00:19:21 2023 -0500
8.3@@ -6,6 +6,6 @@
8.4 default = ["std"]
8.5 std = ["linux-keyutils/std"]
8.6 [dependencies]
8.7+crypto = { path = "../crypto" }
8.8 linux-keyutils = "0.2.3"
8.9-zeroize = "1.6"
8.10-[dev-dependencies]
8.11\ No newline at end of file
8.12+zeroize = "1.6"
8.13\ No newline at end of file
9.1--- a/rust/lib/krypt/readme.org Tue Nov 07 19:50:15 2023 -0500
9.2+++ b/rust/lib/krypt/readme.org Thu Nov 09 00:19:21 2023 -0500
9.3@@ -10,6 +10,8 @@
9.4 general purpose tool.
9.5
9.6 For an introduction to the key management techniques used, check [[https://rtfm.co.ua/en/what-is-linux-keyring-gnome-keyring-secret-service-and-d-bus/][here]].
9.7+
9.8+- [[https://blog.cloudflare.com/the-linux-kernel-key-retention-service-and-why-you-should-use-it-in-your-next-application/][Cloudflare - The Linux Kernel Key Retention Service and why you should use it in your next application]]
9.9 * System Libraries
9.10 - keyutils ::
9.11 The library we are most keen on is [[https://man7.org/linux/man-pages/man7/keyutils.7.html][keyutils]] from the Linux Kernel
9.12@@ -20,7 +22,7 @@
9.13 - secret-service ::
9.14 The [[https://specifications.freedesktop.org/secret-service/latest/][secret-service]] API is the brain-child of GNOME Keyring dev Stef
9.15 Walter and KWallet's Michael Leupold. User-space general-purpose
9.16- secrets management. Linux only. For an overview of
9.17+ secrets management. Linux only.
9.18 - keychain ::
9.19 [[https://developer.apple.com/documentation/security/keychain_services/][keychain-services]] serve a similar purpose to secret-service. It is
9.20 MacOS only.
10.1--- a/rust/lib/krypt/src/lib.rs Tue Nov 07 19:50:15 2023 -0500
10.2+++ b/rust/lib/krypt/src/lib.rs Thu Nov 09 00:19:21 2023 -0500
10.3@@ -1,1 +1,5 @@
10.4 //! lib.rs --- Krypt Key Management Library
10.5+pub use linux_keyutils;
10.6+
10.7+#[cfg(test)]
10.8+mod tests;
11.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2+++ b/rust/lib/krypt/src/tests.rs Thu Nov 09 00:19:21 2023 -0500
11.3@@ -0,0 +1,13 @@
11.4+use crate::linux_keyutils::{KeyRing, KeyRingIdentifier};
11.5+use zeroize::Zeroizing;
11.6+
11.7+#[test]
11.8+fn default_user_keyring() {
11.9+ let ring = KeyRing::from_special_id(KeyRingIdentifier::Session, false).unwrap();
11.10+ ring.add_key("krypt_test_default", "hackme").unwrap();
11.11+ let key = ring.search("krypt_test_default").unwrap();
11.12+ let mut buf = Zeroizing::new([0u8;2048]);
11.13+ let len = key.read(&mut buf).unwrap();
11.14+ assert_eq!("hackme", std::str::from_utf8(&buf[..len]).unwrap());
11.15+ key.invalidate().unwrap();
11.16+}