added old jekyll posts

This commit is contained in:
Thies Lennart Alff 2022-08-18 01:08:07 +02:00
parent e6b3c70cec
commit 2dcc4ee4ff
10 changed files with 194 additions and 3 deletions

View file

@ -43,5 +43,15 @@ url = 'https://gitlab.com/lennartalff/'
[[menu.main]]
name = 'Recipes'
weight = 1
weight = 2
url = 'recipes/'
[[menu.main]]
name = 'Posts'
weight = 1
url = 'posts/'
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true

View file

@ -1,6 +1,8 @@
---
title: Discord Update Blocks Launch
date: '2022-08-10'
categories: ['Software']
tags: ['software', 'fix']
---
If there is an update for `discord` available, the program will refuse to launch and give you the option to download the new version. Options available for Linux are `.deb` packages and archives with the source code. Since I'm using Arch Linux and `discord` is installed via `pacman` neither is a valid choice.
@ -8,7 +10,7 @@ If there is an update for `discord` available, the program will refuse to launch
sudo vim /opt/discord/resources/build_info.json
{{</highlight>}}
```json
``` json
{
"releaseChannel": "stable",
"version": "0.0.18"

View file

@ -0,0 +1,44 @@
---
title: Backup Script for my Nextcloud
date: 2022-04-13
categories: ['Software']
tags: ['software', 'server']
series: ['Nextcloud Backup']
---
## Backup creation via interactive script
The script I use to create the Nextcloud backup is the following:
{% highlight sh %}
#!/usr/bin/bash
set -e
DATE_STR=`date +"%Y-%m-%d"`
BACKUP_DIR="/backup/nextcloud-backup/$DATE_STR"
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
mkdir $BACKUP_DIR
echo "Enter mysql_nextcloud password."
mysqldump --single-transaction -u nextcloud -p nextcloud > "$BACKUP_DIR/nextcloud-sqlbkp".bak
rsync -Aax --info=progress2 /var/www/nextcloud/ "$BACKUP_DIR/nextcloud-dirbkp"
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
{% endhighlight %}
As one can clearly see, it is an interactive script that I invoke when updating my cloud. It performs the following steps:
* Enabling maintenance mode
* Backing up the database
* Backing up the Nextcloud data
* Disabling maintenance mode
The backups are stored in directories named by their date of creation.
## What could be done better?
* Incremental backups to save disk space
* Make the backup completely automated and perform them on a regular time base
* Store the backups not only on a separate drive but on a different computer

View file

@ -0,0 +1,48 @@
---
title: Raspberry Pi 4 and Arducam's OV9281 Global Shutter Camera
date: 2021-12-11
categories: ['Software']
tags: ["software", "raspberry pi", "camera", "ov9281", "raspi"]
---
# Why I prefer the official Kernel Module
At University I'm workin with small scale underwater robots. The vehicle estimates its position and orientation by applying a vision based pose estimation. Since there is not too much light in our test pool, we looked for an alternative to the official Raspberry Pi camera that uses an IMX219 image sensor. A more sensitive sensor allows for shorter exposure times and therefore minimizes motion blur.
For roughly a year by now we have camera boards by Arducam in operation that are based on the OV9281 sensor. To be precise, these boards are exactly of the type shown in the figure below.
{{% rawhtml %}}
<figure>
<img src="/images/ov9281_b0162.jpg" />
<figcaption>Arducam B0162/UC-580 board with the OV9281 image sensor. Not compatible with the official OV9281 kernel module.</figcaption>
</figure>
{{% /rawhtml %}}
Arducam provides a closed-source library, and example code how to access the camera, on [GitHub](https://github.com/ArduCAM/MIPI_Camera). Actually there is not much wrong with using this library. At least if you don't mind that you are bound to Raspbian Buster (or Raspberry Pi OS as they call it now). Even a 64-bit version of the library is provided. So you can use the experimental 64-bit version of Raspbian that can be found in official [Raspberry Pi website](https://downloads.raspberrypi.org/raspios_arm64/images/). But there seem to be [problems](https://github.com/ArduCAM/MIPI_Camera/issues/106) with the 64-bit version of the Arducam library.
I prefer to have more freedom regarding the choice of the operating system I'm going to use. By using the kernel module it does not matter which OS you are using as long as you use a kernel with the corresponding kernel module activated. Hence it does not matter if you are going to use the Raspberry Pi OS or Ubuntu on the Raspberry Pi.
# Problems with Board Compatibility
The problem with the depicted B0162 board is that it is not compatible with the kernel module. This board has only a single data line but the kernel module expects two data lines. If you try to use the kernel module with the B0162 board though, you will recognize that a corresponding video device (e.g. `/dev/video0` most likely) will be created. But if you try to capture an image, you will not get any data.
However, the B0165 camera board in the figure below **is** working with the kernel module.
{{% rawhtml %}}
<figure>
<img src="/images/ov9281_b0165.jpg" />
<figcaption>Arducam B0165/UC-599 board with the OV9281 image sensor. Unlike the B0162 board this board is compatible with the official OV9281 kernel module.</figcaption>
</figure>
{{% /rawhtml %}}
Fortunately we had some laying around. What I didn't know when testing them: their lenses have an infrared-only filter. Since I don't want to limit the camera to infrared light, I removed the filter by dismounting the lense and sraping off the filter from the backside of the lense. I would not recommend to do so in general but to buy an OV9281 board with two data lines and an appropriate lense right away. Removing the filter increased the brightness -- as you would expect -- tremendously.
# TLDR
Make sure you have a camera board with two data lines to be compatible with the kernel module and add the device tree overlay.
Depending on whether you use Raspberry Pi OS or Ubuntu edit `/boot/config.txt` or `/boot/firmware/usercfg.txt` and add the following line
~~~ sh
dtoverlay=ov9281
~~~

View file

@ -1,7 +1,7 @@
---
title: Restore the Linux Bootlaofter after a BIOS Update
date: 2022-06-28
category: Software
categories: ['Software']
tags: ['software', 'linux']
---

View file

@ -0,0 +1,67 @@
---
title: Terraria Server
date: 2022-04-10
categories: ['Software']
tags: ['software', 'server']
---
## Get Your Stuff Together
Download the dedicated server from the [Terraria Wiki](https://terraria.fandom.com/wiki/Server). All information to start the server are provided there as well. The relevant steps here are to create a `serverconfig.txt` and we should not forget to forward the port used by Terraria. By default this is `7777`.
## Configure the systemd Daemon
These steps are heavily inspired by the [linode guide](https://www.linode.com/docs/guides/host-a-terraria-server-on-your-linode/).
Create the file `/usr/local/bin/terrariad`
~~~ sh
#!/usr/bin/env bash
SERVER_CMD_ARG="`printf \"$*\r\"`"
ATTACH_CMD_ARG="-r terraria"
SEND_CMD_ARG="-S terraria -X stuff $SERVER_CMD_ARG"
if [ "$1" = "attach" ]
then
CMD_ARG="$ATTACH_CMD_ARG"
else
CMD_ARG="$SEND_CMD_ARG"
fi
screen $CMD_ARG
~~~
We can attach to a running Terraria server via `terrariad attach` to interact with the server's command line. Or we can directly send server commands like `exit` to save the currently running Terraria world and stop the server via `terrariad exit`.
Create the service file `/etc/systemd/system/terraria.service` and replace the paths and the username so they fit our setup.
~~~ ini
[Unit]
Description=server daemon for terraria
[Service]
Type=forking
User=root
KillMode=none
ExecStart=/usr/bin/screen -dmS terraria /bin/bash -c "/PATH/TO/THE/TerrariaServer.bin.x86_64 -config /PATH/TO/THE/SERVER/CONFIG/FILE/serverconfig.txt"
ExecStop=/usr/local/bin/terrariad exit
User=THE_USER_RUNNING_THE_SERVER
Group=THE_USER_RUNNING_THE_SERVER
[Install]
WantedBy=multi-user.target
~~~
That is almost it! Enable and start the service
~~~ sh
sudo systemctl enable --now terraria.service
~~~

View file

@ -0,0 +1,19 @@
---
title: ZSH Autosuggestions Creates Duplicate Characters
date: 2022-06-28
categories: ['Software']
tags: ['software', 'fix']
---
I have noticed that sometimes the `zsh-autosuggestions` plugin repeats characters after using tab-completion. This happens when the locale environment variables are not set correctly (a detailed explanation can found [here](https://unix.stackexchange.com/a/90876)).
The environment variables can be set persistently in `/etc/default/locale` for Ubuntu systems. My setup looks like
~~~ sh
LANG=en_US.UTF-8
LC_TIME=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
~~~
For my Ubuntu server I realized that the settings in `/etc/default/locale` have been ignored. This can be avoided by setting `UsePAM yes` in `/etc/ssh/sshd_config`. For Debian this would be the default setting.

View file

@ -0,0 +1 @@
{{ .Inner }}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB