rapidjson number keys
Mar 18, 2024

I recently realized that it seemed that rapidjson had issues with serializing a python dict with numbers in its keys:

>>> import rapidjson as rj
>>> import json 
>>> a = {1:"cat"}
>>> json.dumps(a)
'{"1": "cat"}'
>>> rj.dumps(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: {1: 'cat'} is not JSON serializable

nvim autoclose cancel
Mar 14, 2024

One of my main problems with autoclose plugins would be that if I wanted to just enter a single bracket or quote it would be really hard to do so. I’d have to type it, hit Esc and then delete the autoclosed character. It would get even more complicated if I was trying to fix some sort of formatting and I just wanted to add a specific character without it autoclosing. I was finally able to figure out a good setup of having autoclose but also being able to easily enter single characters.


Futhark macOS install
Mar 14, 2024
brew install llvm
nimble  --passL:"-L/usr/local/opt/llvm/lib/"

neovim lua visual select range
Mar 13, 2024
-- correct way
vim.fn.getpos('v') -- start line
vim.fn.getpos('.') -- end line

It’s not super easy to find out how to get the visual select range in neovim lua. You might see


Alternate vim search replace syntax
Mar 11, 2024

I recently came across an alternate syntax for n/vim’s search and replace syntax of s/meow/woof/g which is s#meow#woof#g - found on this post. Basically replacing the / with #. Never seen that before in all the years of using vim, so just thought I’d share!


GitUI push issue
Mar 1, 2024

I’ve been using GitUI as my git user interface and have been pretty happy with it overall! One issue though is that it would seem to randomly not be able to push to my remotes, giving the error of ‘bad credentials’, causing me to regenerate my github token, which wouldn’t fix the issue. The workaround for this issue apparently for macOS is to run the command ssh-add ~/.ssh/id_rsa. I remember doing something like this before and fixing it, but apparently you have to regularly run this command for whatever reason to keep it working normally. More information about the actual cause of the issue can be found in this github issue.


New tmux pane from pwd
Feb 21, 2024

bind c new-window -ac "#{pane_current_path}"

This is a cool config for your tmux.conf where if you open a new pane/tab it will not only open it next to the current pane (-a), but also open it to the same directory as the previous pane (-c "#{pane_current_path}"). This is pretty similar to the functionality of opening a split pane in tmux, which is cool too but I can’t think of how much time I’ve wasted opening a new tab and trying to navigate to the same place as the current tab. Really sort of kills your flow, if you just want a quick side terminal for some stuff.


iOS home indicator bar color
Nov 27, 2023

Adding .defersSystemGestures(on: .bottom) dims the iOS home indicator

There wasn’t a whole lot of information about this specific behavior - I discovered it by accident. The best write up I could find on the matter of the color of the iOS home indicator is this article which goes into detail about what causes the color to change, and how the simulator home indicator color isn’t the same on the device, and this stack overflow post.


macOS app switching with karabiner
Nov 20, 2023

Python walrus update if
Feb 4, 2022

A pretty (common) use case is to have a variable update only upon a condition. For example updating a minLength value:

if minLength > len(cat)- len(dog):
  minLength = len(cat) - len(cat)

Which is inefficient because it has to do the calculation twice, plus you have to type it out. Typically the optimization would be

lenDiff = len(cat) - len(dog):
if minLength > lenDiff:
  minLength = lenDiff

With python’s walrus operator, you can do an assign statement inside an if statement

if minLength > lenDiff:= len(cat) - len(dog):
  minLength = lenDiff