Thursday, 26 October 2023

[Windoof] create symlink

New-Item -ItemType symboliclink -Path <path to location> -Name <the name> -Value <path to target>

e.g. New-Item -ItemType symboliclink -Path C:\Users\thiemo -Name link_to_target -Value C:\Users\thiemo\Downloads
MKLINK [[/D] | [/H] | [/J]] Verknüpfung Ziel

        /D           Erstellt eine symbolische Verknüpfung für ein Verzeichis.
                     Standardmäßig wird eine symbolische Verknüpfung für
                     eine Datei erstellt.
        /H           Erstellt eine feste Verknüpfung anstelle einer
                     symbolischen Verknüpfung.
        /J           Erstellt eine Verzeichnisverbindung.
        Verknüpfung  Gibt den Namen für die symbolischen Verknüpfung an.
        Ziel         Gibt den Pfad (relativ oder absolut) an, auf den die
                     neue Verknüpfung verweist.
                     
e.g. MKLINK /D C:\Users\thiemo\link_to_target /J C:\Users\thiemo\Downloads
Both examples result in a symbolic link, file path C:\Users\thiemo\link_to_target, pointing to C:\Users\thiemo\Downloads

Tuesday, 17 October 2023

[KDE] A menu entry does not start the application complaining about permission problem

 I lately created a menu entry for an application not providing one on its own. As I manage some of my stuff in Subversion, I placed a symlink in ~/.local/share/applications pointing to the file in my local checkout of my repository. Trying to start it, KDE complains about permission problems. It turns out that "it" is not able to handle symlinks properly.

Tuesday, 19 September 2023

[Windows 10] Retrieve non-resizable window that is off-screen

Problem

 At times, when working on different screens, e.g. with a laptop, it happens that one moves non-resizable windows to a position on a screen that "does not exist" on the next working place. It happened to me with the notification window of Outlook. One cannot grab it at the handlebar, obviously. One cannot either grab it with the move command of the context menu of the respective task bar icon. One cannot maximize it to make it visible on the associated screen.

Solution

 However, I just learnt that after selecting the move command and without any other action inbetween, one can press an arrow key and the window gets snapped to the move cursor so one can reposition the window now.

Monday, 14 August 2023

[git] fatal: Authentication failed for 'https://git…

Say, you changed your windows password and now git is dissatisfied with the stored password when operating on a remote repository. You can change the stored password as follows.

rundll32.exe keymgr.dll,KRShowKeyMgr

 

 

Wednesday, 24 May 2023

[Python] pip over proxy (e.g. behind a firewall)

pip install --proxy http://[<usr_name>[:<password>]@]<proxyserver_name>:<port#> <pkg_name>
You might want to upgrade pip while you are at it.
python[.exe] -m pip install --proxy http://[<usr_name>[:<password>]@]<proxyserver_name>:<port#> --upgrade pip

Sunday, 21 May 2023

[ubuntu] Activate the hibernate button/option

Problem

A fresh install of Ubuntu does not sport the hibernate option/button.

Solution not working for me

Presumtion is that you use a swap partition and no swap file (alone, not sure a combination works). Make sure, your swap is at least as big as your memory. You can check with

free -h
In /etc/systemd/logind.conf the hibernate key must be handled by the uncommented line:
HandleHibernateKey=handle-hibernate-key
Activate the setting with
update-initramfs -u
Make sure in /etc/default/grubthere is an entry for your resume partition like
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/dm-0"
You then need to update the grub configuration.
update-grub
Then reboot.

[ubuntu] DNS gone after reboot

Problem

After a fresh installation of kubuntu 22.04 LTS, DNS does not work any longer after a reboot (or shotdown and start).

Solution

Most robust

Edit (possibly create) a file within /etc/systemd/network/. It might be called like 10-dhcp.network, however, it should contain:

[Match]
# Naming scheme: en* -> ethernet, wlan* -> wlan
Name=*

[Network]
DHCP=yes

If you want, you can create for each technology one file. Then you need to restart your network by:

sudo systemctl restart systemd-networkd

Less robust because of static

Make sure that in /etc/systemd/resolved.conf the is an uncommented line
DNS=192.168.2.1 208.67.222.222 208.67.220.220 192.168.1.1
where the ip addresses are the ones of the DNS servers you want to use.

Alternatively

You can configure the DNS servers in each of your network configuration with the network manager of your system or your choice.

Holzhammermethode

sudo ln -sf "/run/systemd/resolve/stub-resolv.conf" "/etc/resolv.conf"

Tuesday, 16 May 2023

[ubuntu] (Fresh install) boot into grub command line

Problem

grub>

Solution

# please note that grub commandline supports some command expansion using tab key
$ # find the root partition
$ ls
$ # set root partition, e.g.
$ root=(lvm/vg-root)
$ # load existing config file, e.g.
$ configfile /boot/grub/grub.cfg
You now should see the selection dialogue of your grub and can boot. To permanently fix the problem, install a tool and run it. Unfortunately, it is not (yet) part of the distribution. Very sadly, you have to add a personal repository. Either sudo the following commands or execute them as root.
$ sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt update
$ sudo apt install -y boot-repair
$ sudo boot-repair

Thursday, 11 May 2023

[git] Undo pushed but unmerged git commit

Problem

You were a bit hasty and committed and pushed something you should not have, e.g., as it has happened to me, into the wrong branch. Now, you want to undo the commit also in the remote repository, but not loose the changes you made.

Solution

Technically, you want, to my understanding

  1. Make HEAD point to the previous commit.
  2. Clean the index from the wrong commit.
  3. Push to the remote repository.
So, you would want to
  • $ git reset --mixed HEAD~
    where ~ stands for the parent commit, to go back more than commit, issue multiple times. The mixed option is the standard and therewith optional.
  • git push
    And this is the rather tricky part, because git might to refuse. In that case, you have two potentially dangerous options and you might want to double check with
    git help push
    I presume if you are on your own branch and nobody is working on it (as it should be?), you are safe with any of the options. Please don't sue me.
    • --force-with-lease
      This will overwrite the changes others are pushing while you are pushing (at least that is what I have understood).
    • --force
      This will overwrite ALL changes others might have pushed inbetween your wrong commit and this fixing.

[git] Create a local branch from another branch

From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...