Skip to content

Instantly share code, notes, and snippets.

View lelegard's full-sized avatar

Thierry Lelegard lelegard

  • Paris, France
View GitHub Profile
@lelegard
lelegard / ubuntu-risvc-qemu.md
Last active January 16, 2024 14:37
Installing Ubuntu for RISC-V on Qemu

Installing Ubuntu for RISC-V on Qemu

This note is a summary of my experience of installing Ubuntu for RISC-V on Qemu on a macOS host. This is just a personal experience. There may be other ways.

For simplicity, all files will be copied in one single dedicated directory and all commands will be run from that current directory.

Initial reference: https://wiki.ubuntu.com/RISC-V/QEMU

Prerequisites

@lelegard
lelegard / ubuntu-s390x-qemu.md
Created January 15, 2024 10:28
Installing Ubuntu for IBM s390x on Qemu

Installing Ubuntu for IBM s390x on Qemu

This note is a summary of my experience of installing Ubuntu for IBM s390x on Qemu on a macOS host. This is just a personal experience. There may be other ways.

If you wonder why I had the silly idea of installing an IBM s390x virtual machine on macOS, 1) because it is possible, 2) because it is a big endian system which can be useful to test the portability of some applications.

For simplicity, all files will be copied in one single dedicated directory and all commands will be run from that current directory.

Initial reference: https://community.ibm.com/community/user/ibmz-and-linuxone/blogs/timothy-sipples1/2020/04/28/run-ubuntu-z-linuxone

@lelegard
lelegard / arm64e-on-macos.md
Last active February 27, 2023 13:43
Apple architectures arm64 and arm64e on macOS
@lelegard
lelegard / pdf-booklet.sh
Created August 29, 2022 21:11
Reorder pages in a PDF file to print a booklet
#!/usr/bin/env bash
# Reorder pages in a PDF file to print a booklet.
# Then, print the output PDF in duplex mode, short-edge binding, 2 pages per sheet.
SCRIPT=$(basename "$BASH_SOURCE")
INFILE=
OUTFILE=
VERBOSE=false
SYSTEM=$(uname -s)
@lelegard
lelegard / create-blank-pdf.sh
Last active August 29, 2022 14:39
Create a one-page blank PDF file, optionally with same page size as an existing reference PDF file
#!/usr/bin/env bash
# Create a one-page blank PDF file.
# Optionally with same page size as an existing reference PDF file (default size: A4).
SCRIPT=$(basename "$0")
usage() { echo >&2 "usage: $SCRIPT output-file [reference-file]"; exit 1; }
error() { echo >&2 "$SCRIPT: error: $*"; exit 1; }
warning() { echo >&2 "$SCRIPT: warning: $*"; }
# Find various tools.
@lelegard
lelegard / set-wallpaper.ps1
Created April 27, 2022 09:03
Set Windows 10 wallpaper from PowerShell
function Set-WallPaper {
<#
.SYNOPSIS
Applies a specified wallpaper to the current user's desktop
Reference: https://www.joseespitia.com/2017/09/15/set-wallpaper-powershell-function/
.PARAMETER Image
Provide the exact path to the image
@lelegard
lelegard / win-autologin-powershell.md
Last active April 21, 2022 14:30
Enabling auto-login on Windows 10 using PowerShell

Enabling auto-login on Windows 10 using PowerShell

On Windows 10, the auto-login feature is notoriously dangerous for general use. However, it can be useful in some specific and restricted environments, for instance a single-user virtual machine running on a desktop system.

Auto-login is normally enabled using the Windows Settings or the Control Panel. This option is available only when Windows is activated. On single-user virtual machines, Windows is not always activated and it is not possible to access this option.

To directly enable auto-login, even on an unactivated Windows system, open a PowerShell window as administrator and run the following commands:

$RegistryPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
@lelegard
lelegard / gentoo-install.md
Last active February 1, 2024 22:13
My Gentoo Linux Installation

My Gentoo Linux Installation

As the title implies, this is "my" experience of Gentoo Linux Installation on a virtual machine. There are too many ways to install Gentoo. This Gist is only designed as a reminder if I need to do this again...

Target configuration:

  • English language, French keyboard, located in France.
  • Init system: openrc, old but default one on Gentoo.
  • Desktop: Gnome.

Installation guides

@lelegard
lelegard / arch-linux-install.md
Last active December 3, 2022 13:08
My Arch Linux Installation

My Arch Linux Installation

As the title implies, this is "my" experience of Arch Linux Installation on a virtual machine. There are many (too many) ways to install Arch Linux. This Gist is only designed as a reminder if I need to do this again...

Target configuration: use English language, French keyboard, located in France.

Installation guides

@lelegard
lelegard / git-set-exec.md
Created December 7, 2021 08:32
Git on Windows: setting executable permission on a script

Git on Windows: setting executable permission on a script

The problem: Create a script (shell, python, whatever) on Windows, add it to a git repository. Then clone or pull the repo on a UNIX system (Linux, macOS). The file won't get the executable permission.

If the script had been created from the beginning on a UNIX system with executable permission, this permission would have been propagated to the repo. However, on Windows, this type of permission does not exist and cannot be set at system level.