<![CDATA[Senpai.Club]]>https://senpai.club/https://senpai.club/favicon.pngSenpai.Clubhttps://senpai.club/Ghost 5.2Tue, 15 Nov 2022 15:14:35 GMT60<![CDATA[Part 1: Create a TypeScript project with VSCode]]>It is pretty easy to create a TypeScript project but the problem (at least for me) is the configuration with VSCode in order for the debugger works. Following I have fetched some configuration that helps create a TypeScript project and configure VSCode in order that you can simply use your

]]>
https://senpai.club/create-a-typescript-project-with-vscode/635314c0e0c76300019629c3Sun, 23 Oct 2022 09:16:37 GMTIt is pretty easy to create a TypeScript project but the problem (at least for me) is the configuration with VSCode in order for the debugger works. Following I have fetched some configuration that helps create a TypeScript project and configure VSCode in order that you can simply use your regular shortcuts to start debugging it.

For completeness' sake, you first have to install TypeScript of course.  I assume you have NodeJS already installed (if not Google or DuckDuckGo NodeJS and you should find very helpful entries).

Install typescript:

npm install -g typescript

Create the Project

Create a new folder and change it.

mkdir project 
cd project

Then init a NodeJS project with npm which asks you a few things and creates the package.json file afterward.

npm init

Then initialize TypeScript which creates the tsconfig.json with your compiler options.

npx tsc --init

VSCode Configuration

Create a  .vscode folder and the two files launch.json and tasks.json. By now your folder structure should look something like the following:

|- .vscode 
  |- launch.json 
  |- tasks.json 
|- tsconfig.json 
|- package.json

Now use the following settings for the launch.json and tasks.json files. The launch.json tells VSCode what to do when you start the debugging (F5) and the tasks.json tells it to run TypeScript without tsconfig.json options.

{
    "configurations": [
        {
            "name": "Launch via NPM",
            "request": "launch",
            "runtimeArgs": [
                "run",
                "dev"
            ],
            "runtimeExecutable": "npm",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        },
    ]
}
launch.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
tasks.json

Now in your package.json file, you should add the dev script so we can start it.

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "ts-node-dev ./src/app.ts"
}
package.json

Now if you try the in-build debugger in VSCode you should be able to debug it like any other application.

For the next part, we will look at how to create a docker container that runs the completed TypeScript project so stay tuned.

Sources & Ressources

TypeScript Programming with Visual Studio Code
Get the best out editing TypeScript with Visual Studio Code.
]]>
<![CDATA[QT on WSL2: reMarkable coding on Windows]]>https://senpai.club/qt-with-wsl/6002e739c0ba350001e8f007Thu, 21 Jul 2022 18:53:21 GMT

Get started with the reMarkable toolchain:

This toolchain is actually from the official reMarkable team. We just need to download and execute it as follows:

wget https://remarkable.engineering/deploy/sdk/sumo_qt5.12_toolchain.sh
sudo chmod +x sumo_qt5.12_toolchain.sh && ./sumo_qt5.12_toolchain.sh

In order to access the toolchain, we now need to source the folder every time we actually want to use it. (you could make it permanent too though) Depending on which path you chose earlier this might look a bit different:

source /usr/local/oecore-x86_64/environment-setup-cortexa9hf-neon-oe-linux-gnueabi

Install QT Creator (GUI) on WSL2

First a few dependencies:

sudo apt-get install -y --no-install-recommends libegl1-mesa libfontconfig  libglu1-mesa libsm6 libxi6 libxrender1 mesa-common-dev
# these are optional if you want to remove qt lib warnings:
sudo apt install -y nvidia-340 mesa-utils && glxgears
2

Then qtcreator:

sudo apt install qtcreator

Now we could try to start it but it will only show errors as there is currently no display connected. In order to get a display working, we can install an xserver variant on windows. I used VcXsrv as it includes creating firewall entries automatically.  You can find the source here. After installing, start it with XLaunch, accept the firewall entries (if prompted) and go through the setup: display number: 0, Start no client and select Disable access control. Now you should be good to go back to the WSL console and start qtcreator on your windows host with qtcreator:

QT on WSL2: reMarkable coding on Windows
QT on WSL2: reMarkable coding on Windows

Now the Qt creator compiler settings ( Tools -> Options -> Kits):

  • Qt Versions
    Name: rM Qt %{Qt:Version} (qt5)
    Path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/qt5/qmake
  • Compilers: (with both Add -> GCC -> C and Add -> GCC -> C++)
    Name: rM GCC
    Path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc
  • Debuggers: (with Add)
    Name: rM GDB
    Path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gdb
  • Kits:
    QT on WSL2: reMarkable coding on Windows

Now add your device directly:

Devices -> Add -> Generic Linux Device

  • IP address: either the IP your device has in WiFi or 10.11.99.1 when connected via USB.
  • Username: root

In case you do not have a private key file yet, go to WSL, type ssh-keygen select your home dir as location and maybe a custom name e.g. remarkable. Now copy the key to your device with ssh-copy-id -i remarkable root@[device-ip].

Add your private key file (~/remarkable) and finish. There might be an error that rsync can not be found but as long as the test, in general, completes everything is fine. (we don't need rsync for that) Now go back to Kits and select the device you just created on the Device.

Now when you type some code you may get some errors about variable has incomplete type: This is because it actually uses clang for this. Disable that by going to Help -> About Plugins -> ClangCodeModel and removing the check. Then restart qtcreator.

Uncheck Enable QML in Projects -> Build & Run -> rM -> Run -> Debugger Settings.

Now you can get started :)

Sources
https://remarkablewiki.com/tech/ssh
https://remarkablewiki.com/devel/qt_creator
https://remarkable.engineering/deploy/sdk/

]]>
<![CDATA[Systemd with WSL2 but not really]]>https://senpai.club/fake-systemd-with-wsl2/625be9a3e263db0001d23b41Sun, 17 Apr 2022 10:54:25 GMTJust a short article about fake systemd with WSL2.

As WSL currently does not have official systemd support (although in the future that might come) I stumbled across an interesting GitHub project by GitHub@kvaps which takes the usual systemctl commands and replaces them with a bash script.

So where you might have used 'systemctl start apache2' the systemctl part is an extra script that handles the start command a little differently than the original. It makes direct use of the 'start-stop-daemon' to start and stop your processes in the background.

Now I have adjusted the script a little so that enabled services on your WSL instance and some LXC containers (at least most Turnkey containers) will auto-start when the console is opened:

This actually works surprisingly well. With the Turnkey WordPress 16.1 container I tried, I could actually manage an easy setup. The only thing I had to block was following services that interrupted the WSL startup or networking in some kind:

networking.service
rsyslog.service
inithooks.service
shellinabox.service
*stunnel4*
rsync.service

You can try this with v1.0.0 of my project bostrot/wsl2-distro-manager: A GUI to quickly manage your WSL2 instances (github.com).

Select an LXC container (e.g. Turnkey Wordpress 16.1):

After downloading and creating the instance you will see the following message:

This is the part where my fork of fake-systemd is installed on the new instance.

After everything is done and you start the instance for the first time you get prompted to enter the default passwords as it is the default with turnkey containers. With the first start it actually starts with the `turnkey-init` command instead of the normal console so that we get the following:

And voilà, wordpress installed on wsl:

Buy WSL Manager - Microsoft Store
A quick way to manage your WSL instances with a GUI.Copy, rename, create, download and use custom rootfs files with WSL in a GUI. Open Source: https://github.com/bostrot/wsl2-distro-manager
GitHub - bostrot/wsl2-distro-manager: A GUI to quickly manage your WSL2 instances
A GUI to quickly manage your WSL2 instances. Contribute to bostrot/wsl2-distro-manager development by creating an account on GitHub.
]]>
<![CDATA[Austria's KlimaTicket]]>https://senpai.club/klimaticket/6180014adbd8f800013e7755Tue, 25 Jan 2022 07:00:00 GMT

Austria's answer to combat climate change.


Available for purchase since the beginning of October, Austria's government has taken a crucial step towards net-zero by 2040. The KlimaTicket (literally meaning climate ticket) allows people to use all sorts of public and private transportation in Austria for the annual price of €1,095, which translates to €21 per week or €3 per day.  

There is also a reduced fare for people with disabilities and people aged under 26 or above 65 years priced at €821 (€15,8 per week or €2,2 per day). For an annual surcharge of €110 for the family upgrade, ticket holders can take up to four children aged between six and 15 years with them on their journeys. Children under six travel for free.

Austria's KlimaTicket
Regional buses, trams, and metro lines are also included.

Furthermore, regional versions of the climate ticket for people who don't plan on traveling across the federal province borders are also planned for a reduced fare in the future.

Austria's KlimaTicket
Like all other major cities, Innsbruck is part of the KlimaTicket initiative as well.

The KlimaTicket is likely just the beginning.

With public transport now cheaper and more flexible than ever before it is estimated that the demand for quality public transport is going to increase in the next few decades. Many services, like the Westbahn or OEBB, have already begun adding more vehicles and personnel to their fleet to minimize the waiting period between rides and achieve a denser timetable. It is estimated that the ticket has already been sold more than 130.000 times and the number still keeps increasing. With billions of Euros of funding now flowing into this infrastructure segment, the Austrian government will likely keep expanding and improving its transport network and reduce the need for cars, especially in urban areas. Nevertheless, the goal is not just to get more people to use public transport instead of their cars but also net-zero by 2040, and in order to accomplish this milestone, many more additional steps have to be taken.


Sources:

Austria's digital government agency(2021). Climate Ticket.
https://www.oesterreich.gv.at/en/themen/bauen_wohnen_und_umwelt/Klimaticket.html

Wikipedia(2021). Klimaticket. https://de.wikipedia.org/w/index.php?title=Klimaticket&oldid=221573693

Official KlimaTicket Website(2021). Main. FAQ. https://www.klimaticket.at/

CNN(2021). Travel. The $3.50 go-anywhere ticket to fight climate change. https://edition.cnn.com/travel/article/austria-klimaticket/index.html

]]>
<![CDATA[Windows Subsystem for Linux (WSL) Distro Manager GUI]]>If you are developing different software that was built on different machines or Linux distros you might have come across the issue that - especially out-of-date - code might only work with a specific distro. To counter that and other stuff Windows has, fortunately, build the Windows Subsystem for Linux

]]>
https://senpai.club/wsl-distro-manager-gui/61d055f1a8c02e000196db81Sat, 01 Jan 2022 16:34:30 GMT

If you are developing different software that was built on different machines or Linux distros you might have come across the issue that - especially out-of-date - code might only work with a specific distro. To counter that and other stuff Windows has, fortunately, build the Windows Subsystem for Linux which enables you to run Linux distros on Linux without a virtualization layer. They also gave the option to import a rootfs to use different distros on it. Unfortunately, it might be a bit cumbersome to get the cmds right to export a WSL instance or quickly set up a new one with a specific distro.

That is why I created a little tool that might help you with a GUI to control your instances a little better.

Windows Subsystem for Linux (WSL) Distro Manager GUI

As the name states this tool allows you to manage your instances with a GUI, quickly create new instances, stop, delete or customize them.

Interestingly Windows does not allow you to install a specific distro twice with their install command. So when you want to create a second instance with the same distro you would actually have to use a rootfs. I automated that process in my tool so it actually downloads the rootfs first into a cache and then re-uses it for new instances. This also allows adding more distros quickly in the future without relying on the Windows Store to update theirs.

For better management, you can also rename your instance labels in this instance without needing to recreate them.

Windows Subsystem for Linux (WSL) Distro Manager GUI

While creating this tool I came across some interesting Windows-Like behavior with WSL and I just wanted to share that:

WSL commands actually return a text with zeros and other non-ascii characters between the encoded characters. So any text that is taken directly from the command line would look like this: "C o p y r i g h t" instead of just "Copyright". I countered that by filtering non-ascii characters out and keeping only everything from 32 to 122 + newline (10). I am not sure if there is a way to circumvent that problem directly with PowerShell but other commands do not return zeros between the text so I guess Windows CMD/Powershell/Terminal account for that and just don't show the zeros in between. If you actually have an explanation for this feel free to educate me.

If you want to use this tool feel free to. It is open-source on GitHub:

GitHub - bostrot/wsl2-distro-manager: A GUI to quickly manage your WSL2 instances
A GUI to quickly manage your WSL2 instances. Contribute to bostrot/wsl2-distro-manager development by creating an account on GitHub.
Windows Subsystem for Linux (WSL) Distro Manager GUI

If you want to support this project and keep the application up-to-date automatically you can also buy it on the Windows Store:

Buy WSL Manager - Microsoft Store
A quick way to manage your WSL instances with a GUI.Copy, rename, create, download and use custom rootfs files with WSL in a GUI. Open Source: https://github.com/bostrot/wsl2-distro-manager
Windows Subsystem for Linux (WSL) Distro Manager GUI

]]>
<![CDATA[Steam announces Steam Deck: a handheld gaming PC]]>

Steam just announced a new handheld gaming device that looks like it is heavily inspired by the Nintendo Switch. That might not be a bad thing though.

As Steam puts it, this is the "All-in-one portable PC" which "runs the latest AAA games--and runs them really well&

]]>
https://senpai.club/steam-announces-steam-deck-a-handheld-gaming-pc/60f07b42a0db5a000146020aThu, 15 Jul 2021 18:46:50 GMT

Steam just announced a new handheld gaming device that looks like it is heavily inspired by the Nintendo Switch. That might not be a bad thing though.

As Steam puts it, this is the "All-in-one portable PC" which "runs the latest AAA games--and runs them really well".

I guess we will see about that but from the specs we see so far I highly doubt it, especially if you get the cheapest version with only 64GB of eMMC storage which could probably not even download most AAA games, especially not CoD Cold War with it's respectable size of well over 100GB.

The Steam Deck will come in three different storage versions: 64GB, 256GB and 512GB with high price jumps in between.

While the cheapest version only has eMMC internal storage it looks like the more expensive versions actually have NVME SSDs installed.

Note:

Despite all that, Steam announced this device would use Linux as its OS. This will probably be a huge deal for Linux Gamers as Steam is already pushing major companies to make their games available and playable on Linux via Steam's inbuild but Open Source Proton tool.  Mostly anti-cheat tools, like Easy Anti Cheat, are currently the reason why a lot of games are not working on Linux. This might change in the next couple of months or years because of that.

End Note.

Steam announces Steam Deck: a handheld gaming PC

Steam announces Steam Deck: a handheld gaming PC

Specs:

Compute

Processor AMD APU
CPU: Zen 2 4c/8t, 2.4-3.5GHz (up to 448 GFlops FP32)
GPU: 8 RDNA 2 CUs, 1.0-1.6GHz (up to 1.6 TFlops FP32)
APU power: 4-15WRAM16 GB LPDDR5 RAM (5500 MT/s)Storage64 GB eMMC (PCIe Gen 2 x1)
256 GB NVMe SSD (PCIe Gen 3 x4)
512 GB high-speed NVMe SSD (PCIe Gen 3 x4)
All models include high-speed microSD card slot

Controls and Input

Gamepad controlsA B X Y buttons
D-pad
L & R analog triggers
L & R bumpers
View & Menu buttons
4 x assignable grip buttonsThumbsticks2 x full-size analog sticks with capacitive touchHapticsHD hapticsTrackpads2 x 32.5mm square trackpads with haptic feedback
55% better latency compared to Steam Controller
Pressure-sensitivity for configurable click strengthGyro6-Axis IMU

Display

Resolution 1280 x 800px (16:10 aspect ratio)TypeOptically bonded LCD for enhanced readabilityDisplay size7" diagonalBrightness400 nits typicalRefresh rate60HzTouch enabledYesSensorsAmbient light sensor

Connectivity

Bluetooth 5.0 (support for controllers, accessories and audio)Wi-FiDual-band Wi-Fi radio, 2.4GHz and 5GHz, 2 x 2 MIMO, IEEE 802.11a/b/g/n/ac

Audio

Channels Stereo with embedded DSP for an immersive listening experienceMicrophonesDual microphone arrayHeadphone / mic jack3.5mm stereo headphone / headset jackDigitalMultichannel audio via DisplayPort over USB-C, standard USB-C, or Bluetooth 5.0

Power

Input 45W USB Type-C PD3.0 power supplyBattery40Whr battery. 2 - 8 hours of gameplay

Expansion

micro SD UHS-I supports SD, SDXC and SDHCExternal connectivity for
controllers & displaysUSB-C with DisplayPort 1.4 Alt-mode support; up to 8K @60Hz or 4K @120Hz, USB 3.2 Gen 2

Size and Weight

Size 298mm x 117mm x 49mmWeightApprox. 669 grams

Software

Operating SystemSteamOS 3.0 (Arch-based)DesktopKDE Plasma

Steam announces Steam Deck: a handheld gaming PC

Sold seperately, there is also a Dock you can get for the Steam Deck with following specs.

Expansion

Peripherals 1 x USB-A 3.1 Port
2 x USB-A 2.0 Ports Networking Ethernet External displays DisplayPort 1.4
HDMI 2.0

Power

Input USB-C Power Delivery passthrough inputDeck connection6" USB-C captive cable with low profile 90° connector

Size and Weight

Size 117mm x 29mm x 50.5mmWeightApprox. 120 grams

If you really want one you should probably be fast looking at the current world-wide chip shortage.

Reservation starts Jul 16th, 10 AM PDT and they say it will start shipping in December 2021.

Sources

Introducing Steam Deck
Steam Deck is a powerful handheld gaming PC that delivers the Steam games and features you love.
Steam announces Steam Deck: a handheld gaming PC
]]>
<![CDATA[Install Windows 11 on non-compatible CPU (i7-7700k) and ASUS Z270-A]]>After you heard about Windows 11 new compatibility list you may be bummed out as a lot older (even flagship-) CPUs are not officially supported by the new update. While that may change and Microsoft could add some CPUs to the list here is a quick guide on how some

]]>
https://senpai.club/install-windows-11-on-non-listed-cpu-i7-7700k-and-asus-z270-a/60dc4eeaa0db5a0001460134Wed, 30 Jun 2021 11:26:25 GMT

After you heard about Windows 11 new compatibility list you may be bummed out as a lot older (even flagship-) CPUs are not officially supported by the new update. While that may change and Microsoft could add some CPUs to the list here is a quick guide on how some of you can still install the Windows 11 Preview Build on your PC.

I tried it with the i7-7700k and the ASUS Z270-A motherboard. This one has PTT support which is an inbuild TPM module required by Windows 11. As far as I know, it only supports TPM 1.2 so if Microsoft decides to bump to TPM 2.0 before launch then there is a definite no for working with that motherboard.

Anyways, here is how to set your motherboard up correctly so you can at least receive some dev channel updates for the Windows 11 Insider Preview.

Set those settings in your Z270-A BIOS: (probably similar ones if your mainboard supports PTT. Check that on the manufacturers page)

  • Advanced/PCH-FW -> TPM Device Selection -> PTT to PTT
  • Advanced/PCH-FW -> TPM Device Selection -> PTP aware OS to PTP Aware.
  • Boot/Secure Boot -> OS Type to Windows UEFI
  • Boot/CSM -> Launch CSM to Disabled (you probably can not start your Linux OS after setting this to disabled)

Restart and that should be it. Open Windows Settings -> Updates -> Windows-Insider-Preview (you might have to enable extended diagnostics). Now you will probably still read something like that your PC doesn't fulfill Windows 11 minimum requirements but you should be able to click on the Start button for the Insider Preview and select the Dev channel thus installing the Windows 11 Insider Preview anyways.

Although following screenshot is in German you will probably get the idea:

Install Windows 11 on non-compatible CPU (i7-7700k) and ASUS Z270-A
Choose the Dev Channel to receive the insider preview.
Install Windows 11 on non-compatible CPU (i7-7700k) and ASUS Z270-A
System Info after updating to Windows 11

Have fun. Updates following...

Update 10/24/2021

AMD announced that there might be a huge (10-15%) performance loss when gaming - with an AMD CPU - on Windows 11. As of October 21, there is a patch available though, which should fix those issues.

Sources:

Minimum hardware requirements
This topic defines the minimum hardware requirements for Windows 10 and all types of devices or computers designed for this release.
Install Windows 11 on non-compatible CPU (i7-7700k) and ASUS Z270-A
]]>
<![CDATA[Fast CD with Dokku on Docker]]>https://senpai.club/fast-ci-for-your-apis-with-dokku/6077409b1973120001bdc93dWed, 14 Apr 2021 22:39:41 GMT

This will be my little journey on how I set up my CD with dokku, nginx as a reverse proxy, as a cache (in case of downtime) and SSL with wildcard domains.

I actually had never heard of Dokku before a few days ago when a client asked me about ways to deliver his API as a test run without setting up big k8s clusters. The first thing that came up my mind was Heroku. But there were some compelling reasons against using it so I did a quick search and found Dokku really quick.

What is Dokku?

The GitHub repo describes it as following:

Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.

Basically it works for the most part just as Heroku does but on your own server. So most people would use it like this: once you have a project that you want to quickly share e.g. an API or some other app you can just push it via git to your dokku instance and like Heroku it does the rest. It automatically sets it up to be running on your domain.

As it is being developed as an open source project for years now it has build up quite a community and therefore a lot of plugins and modifications which lets you manage your instance very easily for the basic stuff.

How to get started?

It isn't very difficult if you know what to do. Although I had some troubles setting it up first as I wanted to use docker and I find the Dokku docs not that good documented when you have no idea whatsoever when you start.

I am familiar with Docker so here is what to do when using it:

1. Run the container. Replace the hostname with the hostname you want to use.

docker container run \
  --env DOKKU_HOSTNAME=dokku.docker \
  --name dokku \
  --publish 3022:22 \
  --publish 8080:80 \
  --publish 8443:443 \
  --volume /var/lib/dokku:/mnt/dokku \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  dokku/dokku:0.24.5

2. Add this to ~/.ssh/config so that you can access it over dokku.docker.

Host dokku.docker
  HostName 127.0.0.1
  Port 3022

3. Generate your SSH key. Make sure to add the private key file to ~/.ssh/id_rsa.

ssh-keygen -b 2048

4. Exec into the docker machine to add an SSH key.

docker exec -it dokku bash
vi /key.pub # paste your pub key and save with ESC -> 'wq!'
dokku ssh-keys:add admin /key.pub
dokku ssh-keys:list # confirm that this has an output
exit

6. Add docker Dokku as a command. (Works with debian/ubuntu and bash. Not sure about others)

nano ~/.bash_aliases
alias dokku="docker exec -it dokku dokku" # add this line then re-login with your linux account

7. Now we can try to deploy our first app.

git clone https://github.com/heroku/ruby-getting-started
dokku apps:create ruby-getting-started

cd ruby-getting-started
git remote add dokku dokku@dokku.docker:ruby-getting-started
git push dokku

Most people would be done now. Maybe the next step in case you want to use a reverse proxy to access the docker container from outside and don't want to directly expose it.

By now you can basically push any git project to dokku and it will work like Heroku. Check whether it knows how to start everything. (It mostly does) Then do the rest by itself.

It also works with subtree repos:

git subtree push --prefix subfolder dokku master

~~ Rest is optional ~~

Depending on your config you might already be done now. In my case I wasn't as I access my server over 2 reverse proxies. If you have NGINX you will probably fine by adding a file to /etc/nginx/sites-enabled with something like this:

server {
    listen 443 ssl;

    server_name *.app.yoursite.com;

    ssl_certificate /path/to/your/certificate;
    ssl_certificate_key /path/to/your/certificate_key;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host            $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

}

Of course with this you would need a TLS/SSL certificate for a wildcard domain. I did that with certbot:

sudo certbot certonly --agree-tos --email your@email.com --manual --preferred-challenges=dns -d *.app.yoursite.com --server https://acme-v02.api.letsencrypt.org/directory --manual

This asks you to confirm after you added a TXT record to your domain and gives you the paths of the certificate & keyfile. Use those to update the NGINX file.

8. Done. Access the test app at https://ruby-getting-started.app.yoursite.com.

Though am I really done? ... No. I had to make it more complicated. So as my internet is not very stable and I have some APIs that are running for static pages hosted outside of my network I decided to put another reverse proxy in front of it. This time with caching when my server is offline.

~~ Do you really need this? ~~

9. Rent a server outside with a good internet connection. AWS in my case. Set everything up including NGINX. Now for the config:

# *.app.yoursite.com domains with caching
proxy_cache_path /var/lib/nginx/tmp/proxy_cache levels=1:2 keys_zone=STATIC:10m max_size=4g inactive=5d use_temp_path=off;

# reverse proxy to apps
server {
    listen 443;

    server_name *.app.yoursite.com;

    ssl_certificate /etc/letsencrypt/live/app.yoursite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app.yoursite.com/privkey.pem;

    location / {
        proxy_cache             STATIC;
        proxy_cache_valid       200 1d;
        proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
        proxy_cache_methods GET HEAD POST;
        proxy_pass https://my-home-network-public-address;
        proxy_set_header Host            $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

}

For this to work I set up another SSL/TLS certificate with certbot but on the new server so that it would auto-renew with Let's encrypt.

10. DONE. This time for real. Yay!

Here a short overview of how a request would work. When a (HTTPS) wildcard domain like yourapp.app.yoursite.com is accessed it goes to the AWS server which has a higher uptime than my network. The server basically connects to the server on our network which then again connects to docker and finally gets the wanted app/site/api. It then forwards the results to the user through all those steps.

We are basically caching every request up to 5 days with the max size of 4GB. Everything older in this cache than 10 minutes will not be used. Then when the day comes and our network is down it uses the 5d/4gb cache and tries to deliver at least most of the common requests.

In the end it turned out to be quite a journey I guess. I have no idea if it was worth all the hassle but I am very happy that I can deploy demos and small APIs with domains, SSL and caching already set up with two commands now.

Hope it didn't hurt to much reading about this. :)

]]>
<![CDATA[Watch Dogs: Legion PC Multiplayer released]]>https://senpai.club/watch-d/60552451f4aa6e00017bebafSat, 20 Mar 2021 10:17:28 GMT

Just a short update that Watch Dogs: Legion PC multiplayer was just released without any notice with the latest update. Earlier this month they postponed the multiplayer mode for PC again reasoning that there were some errors that might crash PCs with certain GPUs.

Here is the original message:

A message from the Watch Dogs: Legion team about the Online Mode: pic.twitter.com/VVeaZ7v7yb— Watch Dogs: Legion (@watchdogsgame) March 5, 2021 Embedded JavaScript

The Watch Dogs: Legion team's message about the PC multiplayer release:

DedSec, the Online Mode of Watch Dogs: Legion for PC launches today! We are deploying TU 3.22 right now and Online will unlock at 11 AM EDT, 8 AM PDT, 3 PM GMT, 4 PM CET, in ~3 hours from now. Full patch notes and more info can he found here: https://t.co/rHxSQBjNx8 pic.twitter.com/0lWY1paPvP— Watch Dogs: Legion (@watchdogsgame) March 18, 2021 Embedded JavaScript

Now we can finally play Watch Dogs: Legion with friends!

Edit 23. March 2021:

Unfortunately there are still some bugs which in my case ended in crashing the Game multiple times - making it unplayble.

]]>
<![CDATA[Benchmarking single board computers with Geekbench for ARM]]>Geekbench released a pre-released version (5.4) of their benchmarking software a short while ago which makes it very easy to benchmark your single board computers and compare them. Of course this might also work with any kind of ARM device.

Right now it works for arm (armv7) and the

]]>
https://senpai.club/benchmarking_arm/60513380353882000164cd01Tue, 16 Mar 2021 23:07:32 GMT

Geekbench released a pre-released version (5.4) of their benchmarking software a short while ago which makes it very easy to benchmark your single board computers and compare them. Of course this might also work with any kind of ARM device.

Right now it works for arm (armv7) and the new RISC-V architecture. It is still a pre-release so it may not work perfectly or show all of your specs or might not even work at all.

If you are using a Raspberry PI (arm architecture) you can download their pre-release here. For RISC-V this is the download link.

Once downloaded extract it (e.g. on linux with tar):

tar xf Geekbench-5.4.0-LinuxARMPreview.tar.gz
cd Geekbench-5.4.0-LinuxARMPreview.tar.gz
./geekbench5

This will run geekbench on your device, upload the results to their site and gives you the link to access them.

As for my passively-cooled Raspberry Pi 4:

Benchmarking single board computers with Geekbench for ARM

Sources:

Geekbench 5.4, https://www.geekbench.com/blog/2021/03/geekbench-54/ (last visited Mar. 17, 2021).

]]>
<![CDATA[Exclude files and filetypes on OneDrive]]>https://senpai.club/exclude-file-types/602c3abb22186d00015b5701Tue, 16 Feb 2021 22:15:50 GMTExclude files and filetypes on OneDrive

As OneDrive has no easy to access feature to exclude specific files or folders from being uploaded here is a little guide on how to do it with the group policy editor.

As a developer using OneDrive to backup your PC works but if you have (by accident?) a cache/debug folder or some other folder in your backup that has a lot of different (maybe even very small files) files, you may have already experienced the limits of OneDrive: Uploading a lot of files is simply put Very slow. E.g for the NodeJS devs: A node_modules folder for even small projects can already contain over 10k files. In my case that wrecked my whole OneDrive installation and it took days until all my stuff was backed up to the cloud.

Use OneDrive Insider preview

First make sure that you are using the OneDrive insider preview version as earlier version may not have this feature yet. For that open OneDrive Settings -> About -> select Get OneDrive Insider preview updates before release

Copy template files

Now go to %LOCALAPPDATA%\Microsoft\OneDrive{OneDriveVersion}\adm and copy the OneDrive.adml (language file) to C:\Windows\PolicyDefinitions\en-US and the OneDrive.admx to C:\Windows\PolicyDefinitions.

Use Local Group Policy Editor

Open the local group policy editor (e.g. with WIN+R and gpedit.msc) and select ?Computer Configuration -> Administrative Templates -> All Settings. Now find Exclude specific kinds of files from being uploaded.

Exclude files and filetypes on OneDrive

Now on Keywords: Show... you can add keywords for files to exclude from being uploaded. Just type the name of the file you want to ignore or like in the description use * as a wildcard to select multiple filetypes or names.

Update 2021/2/18

While using I found two kinda big limitations of this:

  1. This does not seem to work with folders yet.
  2. Only new files are being ignored. Old, already uploaded files stay as they are.

When a file is ignored it has a different kind of icon instead of the OneDrive Sync logo.

]]>
<![CDATA[Cyberpunk 2077]]>https://senpai.club/cyberpunk/5feaff764be6490001d8bda3Tue, 07 Jul 2020 19:43:22 GMT

All the things we know so far

Cyberpunk 2077

If you haven't been living under a rock you've probably heard about Cyberpunk 2077 these days. A game developed by the same company that blessed us with The Witcher series, CD Projekt Red.

In this blog post we're going summarize what we know so far about Cyberpunk 2077. (Status quo 2020-07-07, yes pun intended)


Cyberpunk 2077

First and foremost, the scheduled release date of Cyberpunk for PC and Console is on the 10th of December this year. This means exactly 157 days from today.
However people who are looking forward to play it on Google Stadia will have to hold back until the end of 2020 and it gets even worse. Next-Gen consoles players will have to wait until sometime in 2021.


Cyberpunk 2077

For all the PC players out there, official system requirements haven't been announced yet, but it's safe to assume that you'll need an above average PC to run the game at 1080p and an absolute gaming monster for 4K with 60 frames.
Furthermore, it has been confirmed that Next-Gen consoles will have a graphically upgraded version up for purchase to take use of the additional power.

UPDATE SYSTEM REQUIREMENS:

Cyberpunk 2077

Cyberpunk 2077

Now let's take a look at the game itself. Cyberpunk 2077 is intended to be a first-person, singleplayer, role-playing experience with a possible multiplayer mode coming with updates later on. You're going to play as V , the highly customisable main character.


There are three classes to choose from:
NetRunner, who is focused in hacking
Techie, who is specialized in machinery
Solo, who is trained in combating

As your character V you are going to enjoy the open world of Night City and its surroundings. This metropolis is built around six regions and the Badlands, the outside area of the city.

It is also important to note that the story leads to different endings, which means that you ultimately choose how good of a person you want V to be and more importantly what will happen to Keanu Reeves. Yes, motherf***ing Keanu Reeves is also a character ingame!!!

Also a small little gimmick, CD Projekt Red decided it would be fun to include some minigames.


Cyberpunk 2077

CYBERPUNK: EDGERUNNERS ever heard of that?
Imagine you just finished the game, hanging around at home and don't know what to do. Maybe clean the house, or go grocery shopping or browse furiously through Netflix for some animes, but then suddenly you see the Cyberpunk logo on Netflix and you think...wait what?

You can't believe your eyes, but yes there is definitely a Cyberpunk logo, you click on it and an anime opening starts.

A dream coming true, a 10-episode anime series set in the world of Cyberpunk 2077. The series is called Cyberpunk: Edgerunners and is coming 2022 on Netflix, to be more specific a Netflix Original collaboration with CD Projekt Red and the Japanese animation company Studio Trigger (famous for Kill la Kill).


Now finally to summarize everything in a short paragraph in the end, Cyberpunk 2077 is going to launch on December 10th, 2020 and it features amazing graphics, a great storyline, unique game mechanics and Keanu Reeves. If that's not enough, there will be an anime series in 2022 on Netflix.


Sources:

All information was provided by the official website https://www.cyberpunk.net/ as of 2020-07-07 at 09:21 P.M. CET.

]]>
<![CDATA[Useful programs and scripts for your Home Server]]>https://senpai.club/useful-programs-and-scripts-for-your-home-server/5feaff764be6490001d8bda0Mon, 16 Mar 2020 23:20:06 GMTUseful programs and scripts for your Home Server

Running multiple home servers in many form-factors for several years I came across dozens of useful programs that may help you to set it up or maintain it. Here I will list some of them - and for each a quick guide on the installation and maybe some useful commands - as a reference for myself and others. I will also update it from time to time if I find some new. As I am using mostly my Raspberry Pi's I will use the user pi, the user and group id 1000 in all commands.

Also before using any scripts in general I want to remind you that you should always examine downloaded scripts before running them.

  • chocolately

    • Programs I got on my workstation
    choco install googlechrome firefox 7zip python3 vlc git everything avidemux etcher android-sdk vscode crystaldiskinfo discord origin bulk-crap-uninstaller steam-client keepass origin epicgameslauncher icue autohotkey autodesk-fusion360 krita goggalaxy gpg4win kopiaui obs-studio openconnect-gui openvpn pdf24 postman powertoys resilio-sync-home ubisoft-connect cura-new unity-hub visualstudio2022community webex wireshark wiztree aescrypt microsoft-office-deployment anki nodejs adobereader filezilla microsoft-windows-terminal curl inkscape winscp chocolateygui virtualbox anydesk audacity docker-desktop signal telegram flutter speedtest rufus.portable selenium cpu-z wsl2 lastpass wiztree altdrag gpu-z f.lux nordvpn grepwin nvs powertoys DNSDataView WhoisThisDomain curl alldup dns-benchmark hostsman nmap discord
    
  • docker

    • Installation using convenience script
      curl -fsSL https://get.docker.com -o get-docker.sh
      sudo sh get-docker.sh
      sudo usermod -aG docker pi # relog after this
      
    • Useful commands
      docker run hello-world
      docker ps
      docker logs <container id>
  • docker-compose

    • Installation
      sudo apt install docker-compose
    • Useful commands
      docker-compose up -d (without -d for logs)
      docker-compose down
    • Example docker-compose.yml
      version: '2.0'
      services:
        web:
          build: .
          ports:
          - "5000:5000"
          volumes:
          - .:/code
          - logvolume01:/var/log
          links:
          - redis
        redis:
          image: redis
      volumes:
        logvolume01: {}
      
  • NodeJS 13.x

    • Installation
      curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
      sudo apt-get install -y nodejs
      
    • Useful commands
      node <file>
      npm run
      npm init
  • nodemon

    • Description
      nodemon restarts your application after a change in the current folder
    • Installation
      npm i -g nodemon
    • Usage
      nodemon <file>
  • pm2

    • Description
      pm2 is a process manager with load balancer
    • Installation
      npm install pm2 -g
    • Useful commands
      pm2 status
      pm2 logs <id>
      pm2 start <file>
      pm2 start <file> -- <extra parameters>
  • ssh tunnel

    • Description
      while ssh is already installed on most systems its tunnel feature can be used as a cheap way to forward traffic from a local host behind a firewall over a vps to the public
    • Usage
      ssh -tt -R 0.0.0.0:<server port>:localhost:<local port> root@host -i /home/pi/.ssh/id_rsa -N
    • Server settings
      Edit /etc/ssh/sshd_config and set GatewayPorts yes

Have you come across a useful command or program that I did not list here? Then please leave a comment so that I can add it to the list.

]]>
<![CDATA[A quick guide for Kubernetes on a Raspberry Pi (3, 3B, 4) cluster]]>https://senpai.club/kubernetes-on-raspberry-pi-3-3b-4/5feaff764be6490001d8bd92Sun, 15 Mar 2020 21:51:21 GMT

While there are many guides on creating a cluster with Kubernetes there are less on how to create one with Raspberry Pi's (arm architecture) and even less for novices that explain in an easy way what to keep in mind when doing this.

When I started with this project I knew next to nothing about Kubernetes and what lies behind it. In this article, I will not go deeper into the material than setting it up correctly and deploying an example container (GitLab runner) from Docker hub.

Requirements

  • Raspberry Pi (at least 2GB RAM is recommended for the master so go for RPi 4)

A quick overview of Kubernetes and the used programs

  • kubeadm - master command for the cluster
  • kubelet - this runs the containers
  • kubectl - utility to control the cluster
  • flannel - overlay network for network configuration

Installing kubeadm, kubelet and kubectl

apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl

Initialize kubeadm (on master node only)

kubeadm init --apiserver-cert-extra-sans=<local ip of master node> --service-cidr 172.16.0.0/16 --pod-network-cidr=10.244.0.0/16

After initialization it will give you a command to join the cluster which shall be executed on all slave nodes. It will look something like this:

kubeadm join 192.168.0.66:6443 --token kgr932f.g3j3i453ji0t34 \
--discovery-token-ca-cert-hash sha256:f9i3fh39hf04h93iuh43g4jih3g4oiho3g4

Copy configuration

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install Flannel

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/62e44c867a2846fefb68bd5f178daf4da3095ccb/Documentation/kube-flannel.yml

Example container - gitlab runner

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gitlab-runner-arm
spec:
replicas: 4
template:
    metadata:
    labels:
        arch: arm
    spec:
    containers:
        - image: bostrot/gitlab-runner:latest
        name: gitlab-runner-arm
#          volumeMounts:
#          - mountPath: /etc/gitlab-runner
#            name: gitlab-etc
#          - mountPath: /home/gitlab-runner
#            name: gitlab-home
        env:
            - name: registrationToken
            value: <token>
            - name: description
            value: <cluster name>
#      volumes:
#        - name: gitlab-etc
#          emptyDir: {}
#        - name: gitlab-home
#          emptyDir: {}

Now you can create the container with kubectl apply -f runner.yml. You can shut it down with kubectl delete -f runner.yml.

Sources

Installing kubeadm, kubelet and kubectl - https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl (last visited Mar. 15, 2020)
The Kubernetes network model - https://kubernetes.io/docs/concepts/cluster-administration/networking/ (last visited Mar. 15, 2020)

]]>
<![CDATA[Inspiring TEDs]]>https://senpai.club/inspiring-teds/5feaff764be6490001d8bd9eSat, 14 Mar 2020 13:19:54 GMT
]]>