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 / 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 / purging-old-artifacts-with-github-api.md
Last active January 18, 2024 07:19
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 / 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 / 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 / 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 / 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".