automatically push GitHub commits to GitLab instance

Add a .github/workflows/main.yml file in your repository:

---
name: Mirror Repository

on:
  push:
    branches:
      - master

permissions:
  contents: read

jobs:
  gitlab:
    runs-on: ubuntu-latest
    steps:
      - name: Update CA certificates
        run: | 
            sudo apt-get update && sudo apt-get install -y ca-certificates
            sudo update-ca-certificates
            git config --global http.sslVerify false
            
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 # This must be set to 0 to avoid shallow cloning.

      - name: Mirror Repository
        uses: nickmcummins/github-action-gitlab-mirror@v1.0.1
        with:
          password: ${{ secrets.GITLAB_PAT }}
          repository_url: https://gitlab.com/forks/archlinux-pkgbuilds.git
          username: username@linuxmail.orgCode language: JavaScript (javascript)

Define GITLAB_PAT in the Settings of your GitHub repository:

How to create Windows shortcuts for launching WSL2 GUI apps running on X410

In my previous article https://www.nickmcummins.com/index.php/2025/06/18/x410-run-wsl-gui-applications-as-native-windows-applications/, I explain differences between X410 and the WSL out-of-the-box GUI support called WSLg. WSLg actually automatically creates desktop shortcuts for launching GUI applications installed in WSL. For example, in my %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\archlinux folder, I see shortcuts

If I open one of the shortcut, I can see its properties:

The shortcut’s target is “C:\Program Files\WSL\wslg.exe” -d archlinux –cd “~” — caja. However, with X410, these shortcuts are not automatically created, and will require a slightly different target due to how X410 works:

C:\Windows\System32\wsl.exe -d archlinux /bin/zsh -lc “nohup caja &> /dev/null & sleep 1”

Windows Terminal – change default window split mode (alt+shift+d) to down/horizontal

Open settings.json and add to actions:

    "actions": 
    [
        {
            "command": 
            {
                "action": "splitPane",
                "split": "down",
                "splitMode": "duplicate"
            },
            "id": "User.splitPane.10B260D2"
        }
    ],Code language: JavaScript (javascript)

add to keybindings section:

    "keybindings": 
    [
        ...,
        {
            "id": "User.splitPane.10B260D2",
            "keys": "alt+shift+d"
        }
    ],Code language: JavaScript (javascript)

Now, after pressing alt+shift+d: Windows Terminal - Split Down Screenshot

useful Unix shell aliases

alias strace-defaults='strace -f -tt -T -y -yy '
alias sudo-strace-defaults='strace -f -tt -T -y -yy sudo'
alias ion='sudo ionice -c 1 -n 0 -p'
alias ionp='sudo ionice -c 0 -p'
alias nm-undefined-symbols='nm -C -D -u --undefined-only --with-symbol-versions -g'
alias nm-defined-symbols='nm -C -D --defined-only --with-symbol-versions -g'
alias psx='ps aux | grep -i'
alias rn='sudo renice -n -20 -p'
alias rnp='sudo renice -n 20 -p'
alias psk='sudo kill -9'
alias c='clear'Code language: JavaScript (javascript)

xdg-icon-resource install Windows .ico icon on Linux

Requirements:

  • icoutils – for converting .ico to .png
  • python
  • xdg-icon-resource
  • import os
    import sys
    from os import popen, path
    
    
    def run(cmd):
        print(f'Running {cmd} ...')
        output = popen(cmd).read()
        return output
    
    def pngsize(pngfile):
        return pngfile.split('_')[-1].split('x')[0]
    
    
    if __name__ == '__main__':
        icofile = sys.argv[1]
        iconname = icofile.replace(".ico", "").replace("-", " ")
    
        if path.exists('tmp'):
            run('rm -rf tmp')
    
        os.mkdir('tmp')
    
        run(f'icotool -x  {icofile} -o tmp')
    
        pngfiles = os.listdir('tmp')
    
        for pngfile in pngfiles:
            run(f'xdg-icon-resource install --novendor --size {pngsize(pngfile)} tmp/{pngfile} "{iconname}"')Code language: JavaScript (javascript)

    Usage:

    python xdg_icon_resource_install_ico.py folder-pictures.icoCode language: CSS (css)

patch/git apply – Hunk #hunkNumber FAILED at lineNumber (different line endings).

This error commonly issues with .patch files when the patch and target file use different line ending types (i.e. Windows/DOS/CLRF vs. Unix/LF):

touch .build/x64/status/clone
cd .build/x64/src/sshfs && for f in /cygdrive/c/github.com/sshfs-win/patches/*.patch; do patch --binary -p1 <$f; done
patching file sshfs.c
Hunk #1 FAILED at 365 (different line endings).

The unix2dos / dos2unix and commands can be used to perform conversion. One way to determine the line endings type is to open the files in a text editor like Notepad++ which can indicate the line endings type. But this can also be achieved using the unix2dos command’s -i / --info option:

dos2unix -i 00-passwd.patch
      36       0       0  no_bom    text    00-passwd.patch

The 36 indicates the number of lines that use DOS-style line endings. Here is a wrapper python script for this which prints out the line endings type:

import os
import sys
import re

if __name__ == '__main__':
    filename = sys.argv[1]
    infooutput = os.popen(f'dos2unix -i {filename}').read().strip()
    doslines = int(re.split(r'\s+', infooutput)[0])
    line_ending_type = 'Windows/DOS (CR LF)' if doslines > 0 else 'Unix (LF)'
    print(line_ending_type)Code language: JavaScript (javascript)