nocin.eu

Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] Fill table rows into range table

DATA(pernrs) = VALUE pernr_tab( ( |00000001| )
                                ( |00000002| )
                                ( |00000003| ) ).

DATA(lr_pernr) = VALUE cchry_pernr_range( FOR pernr IN pernrs ( sign   = 'I'
                                                                option = 'EQ'
                                                                low    = pernr
                                                                high   = '' ) ).
"Append row to range

APPEND VALUE #( option = 'EQ'
                sign   = 'I'
                low    = pernr ) TO lr_pernr.

[Docker] Install Docker in LXC running Debian Buster

If you already have an LXC with Debian running, add the following three lines to the lxc config (path /etc/pve/lxc/xxx.conf) and reboot the container:

lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

Now simply install docker.

sudo apt update && apt upgrade -y
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose

Running and managing docker containers requires sudo privileges. If you don’t want to type sudo for every commmand, add your current user to the docker group.

sudo usermod -aG docker ${USER}

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running.

sudo systemctl status docker

Test if the installtions is working correctly with hello-world.

sudo docker run hello-world

Each container you will create gets a unique ID and name you can look up with “docker ps”. To remove the docker instance just use “docker rm” followed by the ID or the container name.

sudo docker ps -a
sudo docker stop relaxed_williamson
sudo docker rm relaxed_williamson

[ABAP] Read IT0008 lgart values

Oldschool abap…

  DATA: BEGIN OF i0008,               
        lgart LIKE p0008-lga01,                         
        betrg LIKE p0008-bet01,
        anzhl LIKE p0008-anz01,
        eitxt LIKE p0008-ein01,
        opken LIKE p0008-opk01,
        indbw LIKE p0008-ind01,                                  
        END OF i0008.

  rp-provide-from-last p0008 space pn-begda pn-endda.    

  DO 40 TIMES                                                   
           VARYING i0008-lgart FROM p0008-lga01 NEXT p0008-lga02
           VARYING i0008-betrg FROM p0008-bet01 NEXT p0008-bet02
           VARYING i0008-anzhl FROM p0008-anz01 NEXT p0008-anz02
           VARYING i0008-eitxt FROM p0008-ein01 NEXT p0008-ein02
           VARYING i0008-opken FROM p0008-opk01 NEXT p0008-opk02
           VARYING i0008-indbw FROM p0008-ind01 NEXT p0008-ind02.
      IF i0008-lgart = '2001'.
        EXIT.
      ENDIF.
  ENDDO.

[Shell] SSH Passwordless Login Using SSH Keygen

Generate key, copy key to server and finally ssh passwordless into your server.

ssh-kegen -t rsa
ssh-copy-id root@ip
ssh root@ip

View your generated key with:

cat /home/user/.ssh/id_rsa           #local
cat /home/user/.ssh/authorized_keys  #server

To disable password authentication permanently you have to edit the ssh config. Be sure to first backup before editing. Now just set PasswordAuthentication to “no” in your config and restart the ssh daemon.

cp /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
nano /etc/ssh/sshd_config
service ssh restart

[SAP] SAP Gui login with single click in KeePass

Just paste the following string into the URL field when creating a new entry in KeePass. You only have to replace three parameters manually:

  • system
  • sysname
  • language

The first two parameters have to match exactly the system settings in your SAP Gui.

cmd://sapshcut -maxgui -system=E01 -sysname="SAP Dev System" -client=011 -user={USERNAME} -pw={PASSWORD} -language=DE

With a single click on the URL string, the SAP Gui will open and log you in.

[NFS] Mount NFS Share inside VirtualBox VM

When receiving an error mounting an NFS share inside your VM:

sudo mount -t nfs xxx.xxx.xxx.xxx:/data/media /mnt/nfs/media
mount.nfs: access denied by server while mounting xxx.xxx.xxx.xxx:/mnt/nfs/media

Just change the network adapter of your VM in VirtualBox from “NAT” to “Bridge Mode”.

As alternative you can force the usage of the TCP protocol when mounting, like it is described here.

[Mint] Installing Manjaro KDE Plasma in VirtualBox 6.0 on Linux Mint 19.2 Cinnamon

Install VirtualBox 6.0 on Linux Mint.

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install -y virtualbox-6.0

Download the Manjaro ISO here.
Run VirtualBox and create a new VM with type “Linux” and version “Arch Linux (64-bit)”. If done, go to Settings -> Display and switch Graphics Controller to “VBoxVGA” to be able to change the screen resolution of your VM. For transparency effects, you can also check “Enable 3D Acceleration”.
(Changing this setting didn’t work on my existing VM, only when creating a new VM. So it’s important to do this step before installing the OS.)

Now go to Storage and add your Manjaro ISO as optical drive.

Start the VM and go through the Manjaro installation process. If done, shutdown your VM, go back to settings and remove the Manjaro ISO as optical drive. Else it will boot again into the installer. Now start the VM again.

To run with the VirtualBox Guest Additions, you only have to install virtual-box-utils inside your VM:

sudo pacman -S virtualbox-guest-utils

[Mint] Installing KDE Plasma Desktop on Linux Mint 19.2 Cinnamon

sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt upgrade
sudo aptitude install --with-recommends kubuntu-desktop

Without the “recommends” you’ll get some errors about missing dependencies like here:

The following packages have unmet dependencies:  kubuntu-desktop : Depends: software-properties-kde but it is not going to be installed

Because Linux Mint 19.2 is based on Ubuntu 18.04., the Kubuntu backports only provides Plasma Version 5.12.19.
Ubuntu 18.04 contains Qt Version 5.9.5 and Plasma 5.13 will need at least Qt 5.10.
You can check the current Qt and Plasma version with

kinfocenter