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 / win-home-admin.md
Last active March 23, 2018 15:51
Enabling the Administrator account in Windows 10 Home

Enabling the Administrator account in Windows 10 Home

To enable the Administrator account in Windows 10 Home and make it appear in the login page:

net user administrator /active:yes

The actual name of the account depends on the locale. On a French system, the Administrator account is named "Administrateur".

@lelegard
lelegard / win-home-gpedit.md
Last active May 28, 2024 01:22
Enabling the Group Policy Editor on Windows 10 Home

Enabling the Group Policy Editor on Windows 10 Home

On Windows 10 Home edition, there is no Local Group Policy Editor (gpedit.msc) and no Local Security Policy Editor (secpol.msc). These tools are reserved to Professional editions of Windows.

It is however possible to install them on Windows 10 Home if you need them.

Open a PowerShell window as administrator and run the following command:

@lelegard
lelegard / win10-sshd.md
Last active June 2, 2024 15:06
Installing Windows 10 "built-in" SSH Server

Installing Windows 10 "built-in" SSH Server

Starting with Windows 10 build 1709, Windows integrates a port of OpenSSH, client and server.

This note describes how to install and configure the OpenSSH server sshd and run PowerShell scripts on a remote Windows server, from a Unix system, using SSH and public key authentication (no password).

Note: The way OpenSSH has been integrated in Windows 10 has changed a lot between versions 1709 and 21H2 of Windows 10. The Gist was updated several times to reflect the changes. This version applies to Windows 10 21H2.

OpenSSH server installation

@lelegard
lelegard / sftp-ls.sh
Created May 10, 2018 17:09
Script to recursively list, synchronize or delete directories on a remote site using SFTP only
#!/bin/bash
#-----------------------------------------------------------------------------
#
# This script recursively lists a remote directory using SFTP.
# It generates a deterministic output format, suitable for scripting.
# Syntax: see showhelp() function below.
#
#-----------------------------------------------------------------------------
#
# Copyright (c) 2018, Thierry Lelegard
@lelegard
lelegard / purging-old-artifacts-with-github-api.md
Last active July 16, 2024 21:01
Purging old artifacts with GitHub Actions API

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@lelegard
lelegard / analyze-github-issues.py
Created July 5, 2021 09:38
Analyze all contributions in the issues area of a GitHub repository
#!/usr/bin/env python
#
# Analyze all contributions in the issues area of a GitHub repository.
# Output a summary of all users and their contributions (issues, pull requests and comments).
# The summary is sorted in decreasing order of number of contributions.
#
import requests # pip install requests, see https://docs.python-requests.org/
# TO BE COMPLETED: fill with the right values for your repo
@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.

@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 / 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 / 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'