Compare commits

..

No commits in common. "9dcfb216d3536c82dc76a61d0cf44c5bafb2f9ff" and "6463bb95a9264961e062d0d211122f6dda755d17" have entirely different histories.

6 changed files with 71 additions and 144 deletions

1
.gitignore vendored
View file

@ -10,4 +10,3 @@
/elisp/wd-imaas.el
/ha-theme-results.org
/support/dashboard
/.emacs.desktop

View file

@ -721,7 +721,7 @@ As I've mentioned [[http://www.howardism.org/Technical/Emacs/beep-for-emacs.html
"Yippee"
"What's next?"
"Notification complete. Happy?"
"Beware, lest the dragons fly"))))
"Beware lest the dragons fly"))))
(beep-when-finished msg)))
#+end_src

View file

@ -47,8 +47,6 @@ At the beginning of the year, I choose a theme, and make a list for the upcoming
(defvar sprint-nicknames sprint-names
"List of 26 Sprint Nicknames from A to Z.")
#+end_src
** 2026
Drunk animals? Everyday AI?
** 2025
This year is the animals representing corporate slogans:
@ -285,39 +283,75 @@ Emacs have an internal rep of a time.
Each year, specify the first day of the first sprint of the year:
#+BEGIN_SRC emacs-lisp
;; CHANGEME Each year as this should update:
(defvar sprint-start-date (get-date-time "2026-01-13")
(defvar sprint-start-date (get-date-time "2025-01-14")
"The date of the first day of the first sprint of the year.
See `sprint-range'.")
#+END_SRC
My company has sprints two weeks long that we can calculate from
My Sprint starts on Tuesday, but this sometimes changed, so let's make this a variable:
#+begin_src emacs-lisp
(defvar sprint-length (* 14 24 60 60)
"The length of a sprint, in seconds. This is 2 weeks long")
(defvar sprint-starting-day 2 "The day of the week the sprint begins, where 0 is Sunday.")
#+end_src
The number of the sprint comes from the number of /bi-weeks/ (14 day increments) from the =sprint-start-date=. We can calculate the number of seconds from this /start date/ and divide it by the =sprint-length=:
We seem to never start our Sprints correctly, and we seem to like offsets:
#+begin_src emacs-lisp
;; CHANGEME Each year as this never matches:
(defvar sprint-offset-value 1 "The number of the first sprint.")
#+end_src
We label our sprint based on the week number that it starts. Note that on a Monday, I want to consider that we are still numbering from last week.
#+begin_src emacs-lisp
(defun sprint-week-num (&optional date)
"Return the week of the current year (or DATE), but starting
the week at Tuesday to Monday."
(let* ((d (get-date-time date))
(dow (nth 6 (decode-time d))) ; Day of the week 0=Sunday
(week (thread-last d ; Week number in the year
(format-time-string "%U")
string-to-number)))
(if (>= dow sprint-starting-day)
(1+ week)
week)))
#+end_src
Let's have these tests to make of this /weekly/ perspective:
#+begin_src emacs-lisp :tangle no
(ert-deftest sprint-week-num-test ()
(should (= (sprint-week-num "2025-01-13") 2)) ; Monday previous week
(should (= (sprint-week-num "2025-01-14") 3)) ; Monday previous week
(should (= (sprint-week-num "2024-01-01") 0)) ; Monday previous week
(should (= (sprint-week-num "2024-01-02") 1)) ; Tuesday ... this week
(should (= (sprint-week-num "2024-01-09") 2)) ; Monday, next week, part of last
(should (= (sprint-week-num "2024-01-10") 3))) ; Tuesday next week
#+end_src
My company has sprints two weeks long, we could be see that on even week numbers, the /sprint/ is actually the previous week's number.
This year, my PM decided to start the sprints sequentially starting with 11, so Ive decided to follow my own naming convention for my filenames.
#+begin_src emacs-lisp
(defun sprint-number (date)
"Return the number of 14-day intervals since SPRINT-START-DATE to DATE.
DATE is a string in YYYY-MM-DD format."
(let* ((end-time (get-date-time date))
(diff-seconds (float-time (time-subtract end-time sprint-start-date))))
;; After calculating the number of 'bi-weeks' (2 week sprint increments),
;; we add one to return the correct sprint:
(1+ (floor (/ diff-seconds sprint-length)))))
(defun sprint-number (&optional date)
"Return the current sprint number, with some assumptions that
each sprint is two weeks long, starting on Tuesday."
(let* ((num (sprint-week-num date))
;; Depending on how late we wait to start the sprint, the
;; new sprint may be on an oddp or evenp week:
(bucket (if (cl-oddp num) num (1- num))))
(thread-first bucket
;; Make 2 week sprints sequential:
(/ 2)
;; Sprint offset number:
(- sprint-offset-value))))
#+end_src
And some tests to verify that:
#+begin_src emacs-lisp :tangle no
(ert-deftest sprint-number-test ()
(should (= (sprint-number "2026-01-12") 0))
(should (= (sprint-number "2026-01-13") 1))
(should (= (sprint-number "2026-01-20") 1)))
(should (= (sprint-number "2025-01-13") 0))
(should (= (sprint-number "2025-01-14") 0))
(should (= (sprint-number "2025-01-27") 0))
(should (= (sprint-number "2025-01-29") 1)))
#+end_src
** Sprint File Name
I create my org-file notes based on the Sprint number.

View file

@ -251,7 +251,6 @@ Or, we can do it automatically when we get into a project (if the project has a
:config
(defun project-pyenv-mode-set (&rest _)
"Set pyenv version matching project name."
(ignore-errors
(let* ((filename (thread-first
(project-current)
(project-root)
@ -262,7 +261,7 @@ Or, we can do it automatically when we get into a project (if the project has a
(buffer-string)))))
(when version
(pyenv-mode-set version)
(pyenv-mode-unset)))))
(pyenv-mode-unset))))
;; Either set/unset the pyenv version whenever changing tabs:
(add-hook 'tab-bar-tab-post-select-functions 'project-pyenv-mode-set))

View file

@ -330,10 +330,10 @@ Lets make a /theme/:
`(mode-line-active ((t (:background ,active))))
`(mode-line-inactive ((t (:background ,inactive))))
`(tab-bar ((t :foreground ,default-fg :background ,inactive)))
`(tab-line ((t :foreground ,default-fg :background ,inactive)))
`(tab-bar ((t :foreground ,default-fg :background ,default-bg)))
`(tab-line ((t :foreground ,default-fg :background ,default-bg)))
`(tab-bar-tab ((t (:inherit variable-pitch :background ,active))))
`(tab-bar-tab-inactive ((t (:inherit variable-pitch :background ,inactive))))
`(tab-bar-tab-inactive ((t (:inherit variable-pitch :background ,default-bg))))
`(doom-modeline-buffer-path ((t (:foreground ,almond))))
`(doom-modeline-buffer-file ((t (:foreground "white" :weight bold))))

105
tmux.org
View file

@ -1,105 +0,0 @@
#+title: Tmux Configuration
#+author: Howard X. Abrams
#+date: 2026-01-15
#+filetags: emacs hamacs
#+lastmod: [2026-01-15 Thu]
I use [[https://github.com/tmux/tmux/wiki][tmux]] infrequently as I'm usually running a bunch of Terminals from within Emacs. Laugh all you want, but Emacs is my terminal multiplexer. That said, frequent network connectivity and long-running jobs make a =tmux= helpful on a remote server.
* Remote Installation
Log in an install =tmux= on a RedHat-based system with a =yum= command:
#+BEGIN_SRC sh :dir /ssh:docker:
sudo yum install -y tmux
#+END_SRC
And on my Ubuntu systems:
#+BEGIN_SRC sh :dir /ssh:docker:
sudo dpkg install tmux
#+END_SRC
* Remote Configuration
Copy the following to =$HOME/~/.tmux.conf=:
#+BEGIN_SRC conf :tangle /ssh:docker:/home/vagrant/.tmux.conf
set-option -g prefix C-`
set -g status-right "| docker "
set-option -g allow-rename off
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# Bind function keys.
bind -n F1 select-window -t 1
bind -n F2 select-window -t 2
bind -n F3 select-window -t 3
bind -n F4 select-window -t 4
bind -n F5 select-window -t 5
bind -n F6 select-window -t 6
bind -n F7 select-window -t 7
bind -n F8 select-window -t 8
bind -n F9 select-window -t 9
bind -n F10 select-window -t 10
#+END_SRC
Not sure why =screen= and =tmux= chose such awful prefix keybindings as ~C-a~ and ~C-b~, so I change this to ~C-`~.
I'm not a tmux power user, as changing windows is about all I do, so I bind the function keys to change tabs.
The following =~/.bash_aliases= enhance tmux:
#+BEGIN_SRC sh :tangle /ssh:docker:/home/vagrant/.bash_aliases
#!/bin/sh
# The following aliases have been installed on this machine.
# - `nw` to create a new Tmux window. Give er a command.
alias nw='tmux new-window'
# - `root` for a TMUX window as the root user.
alias root='nw -n root "sudo su -" '
#+END_SRC
When using Docker sessions on the remote system, the =go= and =logs= opens a new window:
#+BEGIN_SRC sh
# - `go` to connect to a docker container
function go {
nw -n "$1" "sudo docker exec -it $1 bash"
}
# - `logs` for displaying the logs from a container
function logs {
nw -n $1-logs "sudo docker logs -f $*"
}
#+END_SRC
After writing a number of helper aliases, I find it helpful to see those aliases when I roll into a remote server, so put this in the =.bashrc= file:
#+BEGIN_SRC sh
if [ "$HOME/.bash_aliases" ]
then
source "$HOME/.bash_aliases"
grep '^# ' "$HOME/.bash_aliases" | sed 's/^# *//'
echo
fi
#+END_SRC
Note: this can interfere with Tramp.
* Local Access
For a collection of long-running and highly verbose programs (like a remote Anisble run), I use iTerm on a MacOS with a special binding to create Mac-widgets in tmux.
#+BEGIN_SRC sh
ssh -t laptop 'tmux -CC attach || tmux -CC'
#+END_SRC
#+DESCRIPTION: Code to be used for configuring Tmux.
#+PROPERTY: header-args:sh :tangle no
#+PROPERTY: header-args:emacs-lisp :tangle yes
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js