This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# A POSIX-compliant shell script that compares the contents of GSBA files, | |
# created by the GameSave Manager [1] Windows application. Such files are | |
# essentially ZIP files with a GSM_INFO.xml metadata descriptor. | |
# | |
# The script accepts two directories as the arguments; the first is treated as | |
# containing "old" files, and the second, the "new" files. Only games in the | |
# second directory are compared with their counterparts. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# shellcheck disable=SC2086 | |
# A POSIX-compliant shell script that downloads all uploaded attachments from | |
# GitLab issue descriptions and comments for a single project, following the | |
# longstanding open issue [1]. It reads several environment variables to send | |
# the requests correctly via the GitLab API. | |
# | |
# * `GITLAB_INSTANCE`: the host of the target GitLab instance; | |
# * `PROJECT_ID`: the unique project ID for the instance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from argparse import ArgumentParser, RawDescriptionHelpFormatter | |
def solve(size: int, line: list[int]) -> list[bool]: | |
solution = [False] * size | |
needed_to_fill = sum(line) + len(line) - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# A shell script that merges local Git repositories into a new repository. The | |
# script accepts multiple directories and/or glob patterns as arguments. Each | |
# local repository will be moved into a subdirectory, named by the user via | |
# stdin. | |
# | |
# Dependencies: bash 4+, git and git-filter-repo. | |
GIT_REPOS=( "$@" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Makefile to turn the keyboard scroll lock LED into a network activity | |
# indicator LED through kernel instrumentation, as documented below. | |
# | |
# https://www.kernel.org/doc/html/latest/leds/index.html | |
# https://www.reddit.com/r/linux/comments/m2kkna/turn_your_keyboard_leds_into_network_indicators/gqjqmx0/ | |
LEDTRIG_MODULE = /lib/modules/$$(uname -r)/kernel/drivers/leds/trigger/ledtrig-netdev.ko.xz | |
SCROLL_LOCK_LED = $(wildcard /sys/class/leds/input*::scrolllock) | |
NETWORK_INTERFACE = $(shell ip -br addr | awk '/UP/ { print $$1 }') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# A shell script that helps a user to choose between 2^n possible choices by | |
# simulating a tournament through a perfect binary tree with randomly disposed | |
# nodes. It accepts input from /dev/stdin, i.e. through pipes or redirection. | |
# | |
# The power-of-2 input size restriction could be relaxed, but then choices | |
# would be probably less fair without repetitions of the classification process | |
# to make up for the generated tree prioritizing rightmost nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# A Python 3.5+ script that prints a coloured heatmap of activity similar to | |
# the one shown in one's GitHub profile. It has some limitations such as not | |
# printing month and weekday names, because it is hard to predict where to put | |
# the month name. It should work in any terminal that supports 256 colors [1]. | |
# | |
# The script accepts a list of Unix timestamps as piped or redirected | |
# input. For instance, to visualize the commit heatmap of a locally cloned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# shellcheck disable=SC2214 | |
# | |
# A POSIX-compliant shell script that estimates the number of hours taken to | |
# create the contents of a Git repository. The heuristic is based on grouping | |
# bundles of commits according to a certain period limit, accumulating time | |
# differences between pairs of commits in each bundle, and compensating for its | |
# first commit with another parametrized quantity. Timestamps are taken from | |
# the author of the commit. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# shellcheck disable=SC2214 | |
# | |
# A shell script that shows the size of a file in each commit that modifies it, | |
# alongside the timestamp taken from the author of the commit. This is useful | |
# to visualize the size evolution of a file. | |
# | |
# It accepts a single option to customize its behavior, described as | |
# follows. The last argument must be a valid file tracked by its respective | |
# repository, with the first file obtained from git-ls-files(1) as default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env awk -f | |
# | |
# AWK script to send multiple `sendkey` commands to a QEMU virtual machine. | |
# It writes at a rate of roughly 40 keys per second, due to lower delays | |
# resulting in garbage output. | |
# | |
# It makes use of a TCP client created by an external utility, such as OpenBSD | |
# Netcat, to interact with QEMU's monitor and send a stream of `sendkey` | |
# commands. This is a practical way to transfer a small file or to script | |
# interactions with a terminal user interface. |
NewerOlder