Faster key repeat on Windows
With WSL, Windows can be a great developer experience. The one thing which
I did find lacking, especially when moving around in Vim, is that the maxixmum
key repeat rate in the configuration panel is too slow.
I was able to fix that with the following settings in Regedit:
[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"AutoRepeatDelay"="240"
"AutoRepeatRate"="12"
"DelayBeforeAcceptance"="0"
"Flags"="59"
"BounceTime"="0"
You have to login and out again for it to take effect.
Permalink
Latest Neovim on Ubuntu
I’m using Ubuntu for my development environment, and Ubuntu does not have the
latest Neovim in their repository.
That’s why I choose to install the last version by source. The steps I take
are:
wget https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-linux64.tar.gz
tar xfz nvim-linux64.tar.gz
sudo mv nvim-linux64 /opt/nvim
Now you have to make sure that /opt/nvim/bin
is part of your path. If you are
smart, and using the Fish shell, add this to your Fish config.
fish_add_path -aP /opt/nvim/bin
If you are on Bash:
export PATH=/opt/nvim/bin:$PATH
Enjoy your latest version of Neovim!
Permalink
Alacritty as default terminal
I’m using Alacritty as my terminal of choice on Ubuntu (Pop!OS). When installed manually, it does not work with the hotkey of Pop!OS because you can’t set it as the default terminal.
For that to work, you have to manually add it as an alternative and set it:
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator $(which alacritty) 50
sudo update-alternatives --config x-terminal-emulator
Permalink
Patching Berkeley Mono with Nerd Fonts
I’m using Berkeley Mono as my font, which is beautiful, but doesn’t have all the glyphs I need for my terminal and editor.
The glyphs I need are part of Nerd Fonts. This is the command I run to patch Berkeley Mono with the use of Docker:
docker run --rm \
-v /tmp/berkeley-mono/origin:/in \
-v /tmp/berkeley-mono/patched:/out \
nerdfonts/patcher \
--progressbars \
--mono \
--adjust-line-height \
--fontawesome \
--fontawesomeextension \
--fontlogos \
--octicons \
--codicons \
--powersymbols \
--pomicons \
--powerline \
--powerlineextra \
--material \
--weather
I found the above command in this blog post from Serhat Teker: Patching Fonts with Docker.
Permalink
Working with Python
I’m exploring the world of Machine Learning, and in that world, Python is king.
Since it had been a decade since I worked with the language, I had to set up a good development environment, starting with installing Python.
For system-wide Python, I resort to my trusty asdf version manager. It’s a great tool that allows me to install multiple versions of Python and switch between them easily.
I also want pyright
and black
installed with each Python installation, so I first create a file in my home directory called .default-python-packages
with the following contents:
pyright
black
Then I run the following commands to install the plugin, install Python 3.11.4, and set it as the default:
asdf plugin add python
asdf install python 3.11.4
asdf global python 3.11.4
This manages my global Python installation, which I use for standalone scripts.
However, I need to set up a virtual environment to work on a project with dependencies. For that, I use a new tool called Rye. Rye manages everything, including the Python version – so I won’t use asdf
for that.
After installing Rye, I can create a new virtual environment with the following:
rye init my-project
This will create a new directory called my-project
with a rye.toml
file in it. This file contains the Python version and the default packages to install. I can add more packages to it, like langchain
:
cd my-project
rye add langchain
This only adds the dependency but does not install it. For that, we need to run rye sync
.
That’s it! Now we have ASDF for our global Python and Rye for our projects in Python. Enjoy!
Permalink
3, 2, 1... Sleep
I would always deprioritize sleep, stay up late, wake up early. And honestly, it was one of the most stupid things I did.
These days I make sure to get at least 7 hours of sleep. So that’s for the duration of sleep, doesn’t say much on the quality though.
So for quality I have this simple 3, 2, 1 rule:
- 3 hours before sleep: no food.
- 2 hours before sleep: no drinks.
- 1 hour before sleep: no screens.
I’ve been doing this for a while now and it significantly improved my sleep quality. I wake up more rested and I’m more productive during the day.
Permalink
Setting up Fish on the Mac
Fish shell is my shell of choice and having it setup
as default on the Mac requires some extra steps.
When homebrew is installed, run brew install fish
.
After that, edit /etc/shells
and add fish to it:
# sudo edit /etc/shells
Add the bottom of the file add:
/opt/homebrew/bin/fish
Then set the shell as default with:
chsh -s /opt/homebrew/bin/fish
It does require logging again to be activated.
Permalink
Crisp fonts on Alacritty
I’m using Alacritty on the Mac and I noticed how the
font rendering is much thicker than I’m used to on iTerm. On iTerm I use the
“thin strokes” setting, which is not available in Alacritty.
Turns out, you can set it with:
defaults write org.alacritty AppleFontSmoothing -int 0
If you then log in and logout again, your Alacritty will be similar to the
crispness you find in iTerm.
If you want to restore it back to the default, do:
defaults delete org.alacritty AppleFontSmoothing
And if you like to have this kind of crispness across the entire OS. Do:
defaults write -g AppleFontSmoothing -int 0
Permalink
Faster key repeat on the Mac
I like to have my key repeat set high, because I still browse my code line,
by line; yes, I know there are better ways to browse.
On the Mac, if you go through the “System Preferences”, there is only so much
you can do. Luckily, you can get the right settings if you use the terminal.
First, make sure that you have disabled “Slow keys” in “System Preferences > Accessibility > Keyboard > Slow keys”.
Then go into your Terminal of choice and type:
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 12
The normal minimum of KeyRepeat
is 2. Setting it to 1 will have a key repeat
delay of 15ms.
For the InitialKeyRepeat
, the minimum is 10; 15 if you use system settings. I
prefer to set it to 12.
If you want to restore the defaults, just go through the system settings and set
it to a value you prefer.
Permalink
Java with Adoptium on Linux
Recently I wrote down how to get Java installed on MacOS with the help of Adoptium. Well, it turns out, I also use Linux (Pop!_OS if you were wondering).
To install Java on Linux, go to the Adoptium page and download the tarball according to the version and your architecture. I downloaded the LTS 19 for x64:
tar xfz OpenJDK19U-jdk_x64_linux_hotspot_19.0.2_7.tar.gz
sudo mv jdk-19.0.2+7 /opt/
And now make sure that your shell can find it, my shell is Fish, so I added this snippet:
# Java installation through Adoptium
set -l java_version "19.0.2+7"
if test -d "/opt/jdk-$java_version"
set -x JAVA_HOME "/opt/jdk-$java_version"
fish_add_path -aP "$JAVA_HOME/bin"
end
Now you have Java, quickly go install Clojure :)
Permalink