Skip to content

Instantly share code, notes, and snippets.

View AlexTMjugador's full-sized avatar
🐰
Likely going down a rabbit hole to get a neat thing

Alejandro González AlexTMjugador

🐰
Likely going down a rabbit hole to get a neat thing
View GitHub Profile
@AlexTMjugador
AlexTMjugador / bw-backup
Created February 28, 2024 17:58
Backup scripts for personal Bitwarden vaults, storing the results to a password-encrypted LUKS file volume. Perfect for simple and secure off-site backups of Bitwarden vaults where a little human interaction for providing key material is warranted.
#!/bin/sh -eu
# Backs up a personal Bitwarden vault to an encrypted LUKS file store.
. ./bw-common
echo '> Exporting personal vault to JSON file...'
bw export --format json --output "$WORKDIR"/backup/export.json
echo '> Exporting attachments...'
@AlexTMjugador
AlexTMjugador / ffxiv_xivlauncher_proton_launch.sh
Last active February 3, 2024 12:54
FFXIV Proton launch script with XIVLauncher. Supports both launching the game outside of Steam via protontricks and from Steam, as a non-Steam game shortcut.
#!/bin/sh -e
# Script to setup and launch FFXIV using XIVLauncher on a Proton >= 8 Wine
# prefix. Can be used by adding this script as a non-Steam game to Steam and
# choosing the right Proton compatibility layer. Do not modify the default
# target directory, which matches the directory where this script is.
# XIVLauncher files must be installed in the "xivlauncher" subdirectory at the
# script directory. After launching FFXIV for a first time using Steam to set up
# the Proton prefix, launching it outside of Steam via protontricks is supported.
@AlexTMjugador
AlexTMjugador / discticker.sh
Last active April 23, 2023 17:29
Shell script to create nice-looking animated Discord stickers. Supports processing several files in parallel.
#!/bin/sh -e
# Shell script to convert videos to APNG images suitable for use as Discord
# stickers. Tools used:
# - ffmpeg
# - pngquant
# - apngasm
while getopts r:f:p:m:h option; do
case $option in
@AlexTMjugador
AlexTMjugador / reinstall-deb-subtree.sh
Last active November 17, 2022 14:43
Script to download and reinstall all the files within a subtree provided by the Debian packages installed on the system. Unlike reinstalling all the packages, this script only extracts the files within the specified subtree, does not execute any package setup scripts, and stores its results in a configurable directory, making it a better fit for…
#!/bin/sh -e
# Script to download and reinstall all the files within a subtree
# provided by the Debian packages installed on the system. Unlike
# reinstalling all the packages, this script only extracts the
# files within the specified subtree, does not execute any package
# setup scripts, and stores its results in a configurable $OUTPUT_DIR,
# making it a better fit for advanced Linux installation repairs.
#
# When the filesystem to repair does not match the root filesystem
@AlexTMjugador
AlexTMjugador / Clone ext4 partition over network to a maybe different sized partition
Last active October 31, 2022 09:38
Clone a ext4 partition from a computer to another over the network, even if they have different sizes, as long as the filesystem contents fit in the destination partition. UUIDs and labels are copied, so bootloader and mount configurations do not need to be updated.
# Source computer commands (run these first):
$ sudo mount -o ro /dev/sda2 /mnt
$ socat -dd -u EXEC:"sudo tar -C /mnt --acls --xattrs --numeric-owner -vcf - ." TCP-LISTEN:2212
# Destination computer commands (the UUIDs and labels can be obtained with lsblk on the source computer).
# 192.168.0.2 is the IP address of the source computer:
$ sudo mkfs.ext4 -U <source filesystem UUID> -L <source filesystem label> /dev/nvme0n1p2
# Set partition UUID with fdisk (enter expert mode)
$ sudo mount /dev/nvme0n1p2 /mnt
$ socat -dd -u TCP:192.168.0.2:2212 EXEC:"sudo tar -C /mnt --overwrite --numeric-owner -vpxf -"
@AlexTMjugador
AlexTMjugador / PlayerProfile.java
Last active September 16, 2022 23:35
Quick and dirty Minecraft offline to online mode UUID migrator. Works for a Paper server with some plugins, including LuckPerms, when using its default H2 storage engine.
package io.github.alextmjugador;
import lombok.Data;
@Data
public class PlayerProfile {
private String name;
private String id;
}
@AlexTMjugador
AlexTMjugador / PackSquash CLA 1.0.md
Last active November 21, 2021 21:20
Contributor License Agreement (CLA) for PackSquash, version 1.0.

PackSquash Contributor License Agreement (CLA) — Version 1.0

Thank you for your interest in contributing to PackSquash ("We" or "Us").

This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective and take your Contribution into consideration, please approve it via our CLA assistant. This is a legally binding document unless explicitly noted otherwise, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.

0. Human-Readable Summary

This section has no legal value and is provided as an easier to read expression of some key terms of the Agreement. Only the next sections define the legally binding terms of the Agreement.

@AlexTMjugador
AlexTMjugador / dataset-download.py
Last active September 2, 2021 18:44
Freesound API Python script to download original, user-submitted sound files. Uses OAuth2 authentication without a web server.
#!/usr/bin/python3
from freesound import FreesoundClient
from pyrate_limiter import Limiter, RequestRate, Duration
import requests
import fileinput
import os
CLIENT_ID = os.environ["CLIENT_ID"]
@AlexTMjugador
AlexTMjugador / badapple.js
Last active June 8, 2021 09:21
Bad Apple in Moovi (Moodle)
/**
* The Bad Apple video URL. It will be used in the "src" attribute of the <video> element.
*/
var videoSrc = "http://127.0.0.1:8000";
/**
* Whether to show debug data or not.
*/
var debug = false;
@AlexTMjugador
AlexTMjugador / PackSquashIntegrationExample.java
Last active June 16, 2023 19:50
Toy example that shows how to integrate PackSquash in a Java application.
package io.github.alextmjugador;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ProcessBuilder.Redirect;
import java.nio.charset.StandardCharsets;