Create Continuous Integration (CI) Pipeline in Gitlab

Create Continuous Integration (CI) Pipeline in Gitlab Agenda What is Continuous Integration (CI)? What it is the application? How does a CI Pipeline work? What do I need for a CI Pipeline? What steps are necessary? Small Project in Python Server Configuration Python Project Gitlab CI Yaml File stages: - test python_test: stage: test image: python:3.9 script: - pip3 install pipenv - pipenv install - pipenv run python3 -m pytest Server Configuration Server Update # SSH Login ~ ssh root@IP-Adresse # Update Server root@server:~$ apt-get update && apt-get upgrade Create new user # Create new user root@server:~$ useradd -m -s /bin/bash youtube # Change Password root@server:~$ passwd youtube # Add user to sudo Group root@server:~$ usermod -aG sudo youtube Disable root access per ssh # Edit SSH Config youtube@server:~$ sudo vim /etc/ssh/sshd_config # inside vim /PermitRootLogin yes mit no ersetzen # on your keyboard :wq # Restart ssh service root@server:~$ sudo systemctl restart ssh Password-less login + Installation of Docker # on your Laptop / PC ~ ssh-copy-id youtube@server-IP # Login mit youtube ohne Passwort # Installation of Docker youtube@server:~$ sudo apt-get install -y docker....

January 3, 2021 路 2 min 路 Moritz Gnisia

Creation of tridiagonal (banded) matrix with SciPy

How to create a tridiagonal matrix? What is a tridiagonal matrix? It typically looks like this: $$ \begin{array}{cccccccc} a_{11} & a_{12} & 0 & \cdots & \cdots & \cdots & \cdots & 0 \ a_{21} & a_{22} & a_{23} & \ddots & & & & \vdots \ 0 & a_{32} & a_{33} & a_{34} & \ddots & & & \vdots \ \vdots & \ddots & \ddots & \ddots & \ddots & \ddots & & \vdots \ \vdots & & \ddots & \ddots & \ddots & \ddots & \ddots & \vdots \ \vdots & & & \ddots & a_{76} & a_{77} & a_{78} & 0 \ \vdots & & & & \ddots & a_{87} & a_{88} & a_{89} \ 0 & \cdots & \cdots & \cdots & \cdots & 0 & a_{98} & a_{99} \end{array} $$...

February 22, 2020 路 1 min 路 Moritz Gnisia

Entering two commands in PyCharm simultaneously

Entering two commands in PyCharm simultaneously When you are working with matplotlib the default workflow is two create first the image itself with plt.plot() and then plt.show(). Those commands are usually entered after each other. However you can also enter them simultaneously by just concatenating them with a semicolon. So you can run plt.show([1,2,3]); plt.show() and the image if you run PyCharm in the scientific mode will popup immediately.

November 15, 2019 路 1 min 路 Moritz Gnisia

Installation of IPython in a Virtualenv

Working with Virtualenvs like pipenv is more than beneficial as you keep track easily of the different dependencies of your project and dont have to worry about your main python environment. However in during the development of your projects you might run into the situation that you require the shell for just verifying some small functions or run some scripts. The basic python shell provides is definitely suitable for this situation but using a shell like from ipython is even better....

March 24, 2019 路 1 min 路 Moritz Gnisia

Accessing the values of a relationship field in a Django Dashboard

Accessing the values of a relationship field in a Django Dashboard When you would like to group your instances of model by a category that stands in relationship to this model like the following: from django.db import models class model1(models.Model): name = models.CharField(max_length=256) def __str__(self): return self.name class model2(models.Model): some_other_name = models.CharField(max_length=256) name_model_1 = models.ForeignKey(model1, on_delete=models.CASCADE) def __str__(self): return self.some_other_name You might run into the problem that when you group the objects of your model2 by the field name_model_1 that you actually don鈥檛 get the exact values of this field....

March 17, 2019 路 1 min 路 Moritz Gnisia