mounting disks on ubuntu
Aug 5, 2024

workflow for mounting drive on ubuntu:

lsblk # lists the drives
mkdir /media/<mount_name> # if necessary - also may have to chown
sudo mount /dev/sd<letter> /media/<mount_name> # for temp mount
sudo nvim /etc/fstab # for permanent mount on restart etc
/dev/sd<letter> /media/<mount_name> ext4<or_filesystem> defaults 0 0 # insert this line and good to go

chromium on mac with video codecs
Aug 1, 2024
brew tap mtslzr/marmaduke-chromium
brew update
brew install marmaduke-chromium

The default chromium package on homebrew for macOS doesn’t come with certain codecs and so you can’t watch many YouTube’s and I think Netflix DRM stuff. Anyways the easiest way to install chromium with the necessary stuff installed is with the above commands. Hope this helps, God bless!


thumbnails in mpv seek bar
Jul 31, 2024

One thing that I missed from the web youtube player compared to watching a video offline with mpv is the thumbnails in the seekbar. It makes seeking a lot easier in general, but basically everything else is better with an offline playback with mpv, especially with the bookmarks plugin, which I should talk about in another post.

Anyways here’s a quick rundown of how I got it working in mpv on macOS.


HPN-SSH
Jul 27, 2024

HPN-SSH is a fork of SSH that’s tuned for performance. One thing it let’s you do is to send files over without any encryption, which speeds things up a lot! It’s not secure though so you should only do it over a local connection I believe. But if you want to transfer files over your local connection it makes stuff like rsync way more usable.

In order to get it working you need to have it running both on your local and remote machine. The remote machine needs to be running the hpn-ssh server and you use the hpn-ssh client to connect to it. There’s currently no homebrew formula for it working, but I was able to build it for macOS pretty easily.

These commands from the hpn-ssh github worked fine on macOS. Just included the number of cores I wanted to use for make (-j4) and used sudo make install


Define switches in NimScript with a value
Jul 5, 2024

In NimScript you can set flags with a value by doing:

switch("define", "ThreadPoolSize=3")
--define:"ThreadPoolSize=3"

list of tmux actions
Jun 29, 2024

tmux / window-copy.c

So I couldn’t find a list of where the actions you can bind keys to for tmux, such as

bind-key -T copy-mode-vi K send-keys -X halfpage-up

I checked all the manpages but couldn’t find anything. So turns out I could only find them in the source, as linked above. Checking it out I was able to find a cool action which I’ve bound as:

bind-key -T copy-mode-vi W send-keys -X copy-end-of-line-and-cancel

which is pretty handy when copying stuff from copy mode in tmux. Hope this helps, God bless!


crontab notes
May 3, 2024

Just a few quick notes or gotchas that I’ve run into when getting a crontab to run properly. The default shell is sh, and so you should test your commands in sh to see if they run first. You can also apparently set it up to use bash but I haven’t tried that yet. The main gotcha however that I ran into was that apparently % is a special character and it will replace this with a newline unless it’s escaped

So I had a function that is supposed to run randomly with some probability like this

f() { echo "meow" }; (( RANDOM \% 10 == 0 )) && f >> ~/cronlog.txt 2>&1

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

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

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.


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.