Srijan Choudhary

Hi, I'm Srijan Choudhary.

I'm a founding member and software engineering leader at GreyOrange, working on disrupting and redefining fulfillment.

I'm interested in software team leadership, functional programming, distributed systems, artificial intelligence, and software infrastructure.

In my free time, I enjoy traveling, running, playing with technology, listening to music, creating music, and reading.

I write here when I have something to share - a personal project, some difficult problem I solved recently, or just an idea.

Take a look at the about page for more details, or follow me on mastodon.

Recent Articles

Recent Notes

Srijan Choudhary Srijan Choudhary

A small #Emacs #OrgMode quality-of-life tweak. I often need to replace an org heading's title while preserving the original text in the body. The problem is that pressing enter on a heading inserts a line above the properties drawer, which breaks things.

Here's a function that moves the heading title into the body (below the properties drawer and metadata), and binds it to S-RET:

(defun my-org-demote-title-to-body ()
  "Move the current heading's title into the body, below the metadata.
  Point returns to the heading for editing."
  (interactive)
  (org-back-to-heading t)
  (let* ((element (org-element-at-point))
         (title (org-element-property :raw-value element)))
    (org-edit-headline "")
    (save-excursion
      (org-end-of-meta-data t)
      (insert title "\n"))
    (org-beginning-of-line)))

(defun my-org-shift-return ()
  "On a heading, demote title to body. In a table, copy down."
  (interactive)
  (cond
   ((org-at-heading-p) (my-org-demote-title-to-body))
   ((org-at-table-p) (org-table-copy-down 1))
   (t (org-return))))
  (define-key org-mode-map (kbd "S-<return>") #'my-org-shift-return)
Srijan Choudhary Srijan Choudhary

Faced a failing disk in my raidz2 ZFS pool today.

Recovery was pretty simple:

  1. Asked the service provider to replace the disk
  2. Find new disk ID etc using:
    lsblk -o NAME,SIZE,MODEL,SERIAL,LABEL,FSTYPE
    ls -ltrh /dev/disk/by-id/ata-*
  3. Resilver using:
    sudo zpool replace lake <old_disk_id> <new_disk_id>
  4. Watch status using:
    watch zpool status -v

Re-silvering is still ongoing, but hopefully completes without issues. Will run a manual zpool scrub at the end to make sure everything is okay.

Srijan Choudhary Srijan Choudhary

A small elisp snippet that I found useful. I often switch between terminals and #Emacs, and they have slightly different behaviors for C-w. This makes it behave the same in Emacs as it does in bash/zsh/fish etc - deletes the last word. It retains the kill-region behavior if a region is actually selected.

(defun kill-region-or-backward-word ()
  "If the region is active and non-empty, call `kill-region'.
Otherwise, call `backward-kill-word'."
  (interactive)
  (call-interactively
   (if (use-region-p) 'kill-region 'backward-kill-word)))
(global-set-key (kbd "C-w") 'kill-region-or-backward-word)

Ref: https://stackoverflow.com/questions/13844453/how-do-i-make-c-w-behave-the-same-as-bash