The awesome stuff Leon

Running a command after a ssh login

I use tmux a lot for handling different sessions. What is annoying that everytime when I ssh to a machine a first need to run the command to open the tmux session.

Here is a simple config so that when you login into ssh it will immediately run the tmux command so that you don't have to type it yourself after login. Saves you a couple of seconds with every login :)

Edit your $HOME/.ssh/config and add the "remotecommand" for the host that you are loggin into:

AddKeysToAgent yes
Host myspecialhost.nl
        RemoteCommand /opt/local/bin/tmux new -A -s chat

Now do a ssh leon@myspecialhost.nl it will do the command.

Improving Window Management on macOS

Recently I have started using Yabai and Skhd. These are two very helpfull tools to easily switch focus between windows on osx.

I like to use the "Mission Control" with multiple screens to focus on specific jobs. Like one with a terminal and one with IntelliJ.

Yabai is a window management utility that easily rearranges your windows

Skhd is a hotkey daemon so that you also can easily interact with the windows.

Installing the tools is as easy as you can expect:

brew install koekeishiya/formulae/skhd
brew services start skhd

brew install koekeishiya/formulae/yabai
brew services start yabai

Small tip for the IntelliJ users:

"Go to IntelliJ IDEA > Preferences > Appearance & behavior > Appearance > UI Options > Always show full path in window header"

Then add to the configuration of yabai:

yabai -m rule --add app="IntelliJ IDEA" manage=off
yabai -m rule --add app="IntelliJ IDEA" title=".*\[(.*)\].*" manage=on

Now yabai will only take control of intelliJ main screen and not try to resize the popups

For more information

I recommend watching the following youtube clip from Josh, he really gives a nice explanation on how to use them.

https://www.youtube.com/watch?v=fYsCAOfGjxE

Apple Airplay on Raspberry Pi

We have an old audioset, which looks pretty nice, but is very old skool. Only an audio in cable and nothing else. No bluetooth, no airplay, no streaming.

I have some USB audio output connectors, those are perfect for creating a small audio system with the Raspberry Pi. (as you maybe know, the 3mm jack on the Pi is not that great)

Start with a Pi3 or newer. If you use the older ones you could get some glitches during playback because lack of cpu power.

Start with install the Raspbian Lite images and enable SSH

Configure the Airplay Server:

Install the deps:

# sudo apt-get update sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman

Now lets build and install shairpoint-sync:

# git clone https://github.com/mikebrady/shairport-sync.git
# cd shairport-sync
# autoreconf -i -f
# ./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata
# make
# sudo make install

The metadata in the configure line is used to be able to show the audio information to an external screen or external service.

Lets start the service and make sure the service starts after a reboot:

# sudo service shairport-sync start
# sudo systemctl enable shairport-sync
# sudo reboot

When the reboot is done, check if the service started:
# sudo systemctl status shairport-sync.service

Make sure the Wifi stays up and running without dropouts:

# sudo nano /etc/network/interfaces

Go to the end of the file and add the lines:
# Disable wifi power management
wireless-power off

Save and do a reboot:
# sudo reboot

Change the audio default:

Because I use an usb adapter for doing audio out, you need to tell alsa to use usb as the default:

# sudo nano /usr/share/alsa/alsa.conf

Replace the 0 to 1 for the following lines:
defaults.ctl.card 0
defaults.pcm.card 0

Save the file and reboot and all should work as expected :)

Inspired by 7-easy-steps-to-apple-airplay-on-raspberry-pi and updating-alsa-config

Testcontainers and permissions issue on OSX

We use testcontainers to easily do integration tests that depend on other services.
It makes it easy to spin up docker container in your tests. With Quarkus it is even simpeler because it supports testcontainers out of the box.

Unfortunately I kept getting an issue with running the mariadb container.
As soon as the test starts after a few seconds the mariadb gets shutdown again.

After checking the log of the shutdown container I found that it didn't have permission to read the my.cnf file.

I was really stuck, I had no clue but after searching I found this nice post talking about permissions.

This got me thinking because I have set umask pretty strict because of security reasons. Here is a nice post that explains it. Mine is set to 027.

After setting the umask to 011 I still had the same issue.
When I do a:

/tmp> ls -la
total 208
drwxrwxrwt  20 root       wheel    640 Feb 16 12:10 ./
drwxr-xr-x   6 root       wheel    192 Jan  1  2020 ../
drwxr-x---   3 logic  wheel     96 Feb 16 12:09 .testcontainers-tmp-379975470819841649/

As you can see, the settings are still wrong. Then it hit me, gradle is running as a daemon. You need to restart the daemon to pick up the new umask settings.

This fixed it :

drwxrw-rw-   3 logic  wheel     96 Feb 16 12:14 .testcontainers-tmp-14701789202178352376/
drwxrw-rw-   3 logic  wheel     96 Feb 16 12:14 .testcontainers-tmp-2461134091080897801/

So now I have a zsh function that will alter the umask when I run gradle.

2020 and gaming

I was looking at the game release list of last year. You know January is the month of lists and I was wondering what game I played the most.

I found it strange that for me the games that topped my list are games that are pretty old and just received a bump, in being remastered or being extended with more DLC in some form.

Yes, I am a very big Skyrim fan. So Skyrim was on top of my list. I played it on my OneXplayer and it is perfect to play it on. Playing on a small screen and easily switching to my dock so that I can play it on my ultrawide screen.

And the second game I really enjoyed was Mass Effect the remaster trilogy.

I really hope that after Cyberpunk in 2019 a new game can really catch my attention. I have big hope for Starfield. Yes it is Bethesda again :)

Honorable mention is btw for Forza Horizon 5.

Older Posts