Return a function that returns the second largest item in a binary search
tree (i.e. BST).
A BST is a tree where each node has no more than two children (i.e. one left
child and one right child). All of the values in a BST's left subtree must be
less than the value of the root node; all of the values in a BST's right subtree
must be greater than the value of the root node; both left and right subtrees
must also be BSTs themselves.
I solved this problem thrice -- improving the performance profile each time. The
final solution has a runtime complexity of O(n) and a spacetime complexity of
O(1).
Write a function that returns true if a given binary tree is a valid binary
search tree (i.e. if all of root's left nodes are less than root.value, all of
root's right nodes are greater than root.value, and both left and right subtrees
are also valid binary search trees).
Write a predicate for determining if a binary tree is "super balanced", which
means that the depths of all of the tree's leaves are equal or differ by at most
one.
I wrongfully assumed that the relationship between a question and a question
category was one-to-one; it is actually one-to-many. This explains why I
completed the "Cafe Order Checker" and "Top Scores" questions twice.
I'm marking the questions that I've completed as DONE because I would prefer to
do every question once and then prioritize repeating the questions with which I
experienced difficulty.
From what I understand, gLinux and Nix are sometimes compatible and sometimes
incompatible.
Some nix-installed programs rely on system state that differs from gLinux's
system state. In other cases, Google wraps existing programs (e.g. git) to
provide Google-specific configuration.
Ever since I switched to home-manager and set `programs.git.enable = true`,
magit, which uses the git that PATH exposes hasn't been able to push, fetch, and
a few other commands.
TODO(wpcarro): Define a base home.nix that my gLinux and NixOS machines can
extend.
Write a function to sort a list of scores for a game in linear time. While I had
previously solved this in python, I hadn't marked the todo.org file, so I ended
up doing this again.
"Perfect practice makes perfect."
Get all pstree outputs for a given process name.
Usage:
```fish
> ptree ssh-agent
```
I'm unsure if I like home-managers; I'd prefer defining this functions in a
functions.fish file for a few reasons:
- I like syntax highlighting.
- home-manager compiles this into poorly formatted fish code.
For two days I tried using gpg-agent to emulate ssh-agent, but it did not work
the same way as ssh-agent. For example, gcert stopped working. Also, when I
tried adding keys to ~/.gnupg/sshcontrol using `ssh-add ~/.ssh/id_rsa`, the
command failed.
While the concept of reusing gpg-agent for ssh-agent appeals to me...
- Fewer agent processes
- pinentry support
...in practice, it fell short of my expectations. Some or all of this may be
because I tried running this on a gLinux machine.
- caffeine.md: an explanation of my theory that caffeine antagonizes
mindfulness.
- nix-and-hugo.md: a short tutorial explaining how I use Nix, the package
manager and Hugo, the static site generator, to host my blog.
- self-hosting.md: explain how I installed NixOS on my used Acer laptop.
I removed the startup code from .profile. I also depend on a fork of
home-manager until I submit my PR from wpcarro/home-manager into
rycee/home-manager.
redshift didn't properly work because it couldn't read the DISPLAY environment
variable. I can fix this ad-hoc with `systemctl --user import-environment
DISPLAY`, but home-manager will do this automatically if I allow it to manage my
xsession.
I think I removed the `(server-start)` call when I was debugging some EXWM
issues. I have stabilized my configuration considerably since then, and I'd like
to use the Emacs server.
I'm not doing enough Rust development to justify supporting this. I'm also in
the midst of a cleaning frenzy, so it's possible that this is just collateral
damage. I don't think it is because I can always use lorri to set this value
when I'm writing Rust (hopefully the second 1/2 of this year).
If you haven't noticed, home-manager is managing increasingly more of my
configuration.
- Migrate session variables to home.nix
- Drop support for unused session variables like TERMINAL, VISUAL
TIL: gpg-agent sets the SSH_AUTH_SOCK and other values. Since I already use
home-manager to start gpg-agent and SSH has been functioning without issues, I'm
removing the obsolete ssh-agent code.
Write a function that finds one duplicate number from a list of numbers 1..n.
The function should satisfy the following performance objectives:
Runtime complexity: O(n*log(n))
Space complexity: O(1)
I'm adding Google Ads to my blog to:
- learn more about Google AdSense
- attempt to offset the my advertising costs for learn.wpcarro.dev
I may need to surround the <script></script> tags with markup to positions the
ads optimally. I will publish this first, see what it looks like without any
markup, and then progress.
My Emacs automatically trims trailing whitespace when I save a buffer. As a
result, this diff appears whenever I edit the baseof.html file. Instead of
continuing to ignore the diff, I'm committing it.
Started working on my debut blog post about giving up my cell phone during
march.
I'd like to publish this post by the end of the month, once I conclude the
experiment. At that time, I'd like to change the voice of some the content to be
past test. For now, I'm dumping ideas here while they're fresh in my mind. I
will refine and prune the final post later.
To create new posts, I run...
```shell
hugo new name-of-post.md
```
While writing posts, I run...
```shell
hugo serve -D
```
I need hugo available on PATH environment variable, which lorri provides.
Write a function that accepts a rotated cycle of alphabetically sorted strings
and returns the index what should be the first element if the elements were not
rotated.
Instead of creating my own static website generator, I'm trying Hugo. Huge is a
newer alternative to Jekyll. So far, I like what I see.
- Ignoring /blog/public since this is where `huge -D` generates the static
assets.
- Using a TailwindCSS theme.
- Creating a dumby post about Emacs to test deployments.
- Deleting all Common Lisp and Nix code that powered my previous, half-baked
blog.