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
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
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
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
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
![Alacritty on the Mac screenshot of my Alacritty setup on the Mac](/images/crisp-fonts-alacritty.png)
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
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
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
I love the smart dashes – and I use them heavily – on the Mac and it’s something I missed on PopOS!.
Luck be it, Espanso comes along. Installation on a Debian system is easy.
Configuration of Espanso is done by editing configuration files located in ~/.config/espanso
directory. You can also find it by tying espanso path
. The files contained in the match
directory define what Espanso should do. The files contained in the config
directory define how Espanso should perform its expansions.
To replace our double dashes with a long dash we are going to edit $CONFIG/match/base.yml
add change it to:
matches:
- trigger: "--"
replace: "—"
However, now this also happens in our terminal, which is annoying, so we are going to disable Espanso completely in the terminal with an app specific configuration.
We’ll disable it in Alacritty, my terminal of choice by creating a config/alacritty.yml
and match on the class name:
filter_class: Alacritty
enable: false
That’s it, Espanso is super powerful and I can recommend reading the docs on what else it can do. Oh, and it also works on MacOS or Windows.
Permalink
Often when I start a new project, I also need to have a .gitignore
for the specific language that I’m working in.
To easily do this, I added the following alias to my git, which pulls a template from gitignore.io:
git config --global alias.ignore \
'!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi'
Now you can do git ignore zig
and it will show you the default ignore file for a Zig project.
To automatically put it in your gitignore, just redirect the output:
git ignore zig >> .gitignore
Permalink