Shun's org notes

Welcome! I'm Shun, a novice software engineer. Here I publish my Org notes to share cool things I discover along the way.

I'm a daily driver of Nix & Emacs; consequently, most of my notes revolve around these two ecosystems.

Does anyone find Google's AI search usful?

I've never found Google's "AI Overview" particularly helpful. It's been more distracting than useful, and worse still, there seems to be no way to turn it off.

Since then, I've switched to DuckDuckGo's “No AI” search at https://noai.duckduckgo.com/, and that has worked well for me.

Here's how to configure it in Home Manager. I use Librewolf, but this should work the same way in Firefox:

librewolf = {
  enable = true;
  policies = {
    GenerativeAI.Enabled = false; # Bonus: turn off other Firefox AI features
  };
  profiles.<my-profile> = {
    search = {
      force = true;
      default = "ddg-noai";
      engines = {
        "ddg-noai" = {
          urls = [
            {
              template = "https://noai.duckduckgo.com/";
              params = [ (lib.nameValuePair "q" "{searchTerms}") ];
            }
          ];
          definedAliases = [ "@noai" ];
        };
      };
    };
    ...
  };
...
};

histsync: sync shell history with pass

Atuin is super cool: it let's you sync shell history across machine, but few issues for me:

  1. Requires a server. I distrust managed public servers and don't want to host my own.
  2. Heavy LLM usage for development. I have nothing against LLMs but I try to avoid them.

I use password-store (pass), so why don't I leverage this:

bash = {
  enable = true;
  # ... 
  initExtra = ''
    histsync() {
      # Append currently history to HISTFILE
      history -a

      # Entry name in pass - I separate history by host
      local passentry="ShellHistories/$HOSTNAME"

      # Merge HISTFILE and pass entries, remove duplicates, update HISTFILE
      (cat "$HISTFILE" 2>/dev/null; pass show "$passentry" 2>/dev/null) |
        awk '!a[$0]++' |
        ${pkgs.moreutils}/bin/sponge "$HISTFILE"

      # Update pass entry with the merged history
      <"$HISTFILE" pass insert -mf "$passentry"

      # Reload history for current session
      history -c
      history -r
    }

    # ...
  '';
};

Note: the merge logic will not work if you use timestamps.

password-store: nerd snipe quagmire

I've been using Apple's Passwords.app, but password-store (pass) seemed very cool, and since I already did the heavy-lifting of setting up the YubiKey, I decided to migrate.

Another reason that convinced me: Emacs supports pass as an auth-source natively! Here is a sample:

(auth-source-pass-enable)

(auth-source-pass-get 'secret "foo/bar")

You can also use password-store.el to interact with pass via Emacs.

Setting up my YubiKey

To manage my GPG key, I set up my YubiKey (5C NFC). This guide was extremely helpful: https://github.com/drduh/YubiKey-Guide.

One note: if you're using ed25519 for your signing key, make sure to set KEY_TYPE=cv25519 before creating the encryption (E) subkey - GPG will complain otherwise.