This file contains hidden or 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 | |
| # Author: Urpagin | |
| # Date: 2025-11-30 | |
| # Description: eXecute C (xc) compiles and executes a C project | |
| # without cluttering your machine. | |
| set -euo pipefail | |
This file contains hidden or 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
| #if 0 | |
| _TMP="$(mktemp -d)" | |
| clang -Wall -Wextra -pedantic -o "${_TMP}/a.out" "$0" | |
| "${_TMP}/a.out" "$@" | |
| RV=$? | |
| # [, [[ and test are unsuitable on some shell (e.g., dash) | |
| case $_TMP in | |
| '/tmp/'*) | |
| rm -rf "$_TMP" |
This file contains hidden or 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 | |
| # Author: Urpagin | |
| # Date: 2025-11-11 around 20:00. | |
| # License: MIT | |
| # Description: - Makes a backup of an entire directory (including hidden files) | |
| # and conserving permissions and other metadata using the tar algo first. | |
| # - Creates .tar.7z files and uses maximum 7z compression. | |
| # - CLI flags for a filename, appends the date after. | |
| # E.g., <name>_YYYY-MM-DD_HH-MM-SS.tar.7z |
This file contains hidden or 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
| #if 0 | |
| TMP=$(mktemp -d) | |
| clang -Wall -Wextra -pedantic -o ${TMP}/a.out ${0} && ${TMP}/a.out ${@:1} ; RV=$? | |
| rm -rf ${TMP} | |
| exit ${RV} | |
| #endif | |
| /// Metadata | |
| /// Author: Urpagin | |
| /// Date: 2025-10-09 @ 02:54AM |
This file contains hidden or 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 python3 | |
| # Author: Urpagin | |
| # Date: 2025-09-19 | |
| # Description: Counts and prints the number of draws needed to obtain an even number. | |
| # Numbers randomly selected between 1 and 6 (inclusive). | |
| # License: MIT | |
| print(f"{(rnd := __import__('random')) and ''}{((END := [0]), '')[1]}{(nums := len([n for n in iter(lambda: (lambda r: r if r % 2 != 0 else (END.__setitem__(0, r)) or END)(rnd.randint(1, 6)), END)]) + 1) and ''}There {'have' if nums > 1 else 'has'} been {nums} draw{'s' if nums > 1 else ''} before getting an even number: {END[0]}.") |
This file contains hidden or 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 | |
| # Author: Urpagin | |
| # Date: 2025-08-30 | |
| # Description: Plays a random audio/video file given a directory. | |
| # Default directory is cwd. | |
| # Licence: MIT | |
| set -euo pipefail |
This file contains hidden or 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
| // | |
| // Created by Urpagin on 2025-08-28. | |
| // | |
| // A simple logger that does the work inside a dedicated thread so as | |
| // not to block other operations too much. | |
| // | |
| // Licence: MIT | |
| // | |
| // "Multiple Producers, Single Consumer" type of logger. | |
| #pragma once |
This file contains hidden or 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 | |
| # Author: Urpagin | |
| # | |
| # Date: 2025-08-18 | |
| # | |
| # License: MIT License, Copyright (c) 2025 Urpagin | |
| # | |
| # File: dl | |
| # |
This file contains hidden or 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 | |
| t='<FORGEJO API KEY>' | |
| u='<FORGEJO_URL_WITH_PORT>' # e.g., http://localhost:3000 | |
| curl -X POST $u/api/v1/repos/migrate \ | |
| -H "Authorization: token $t" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "clone_addr": "<GITHUB URL>", |
This file contains hidden or 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 | |
| # Patches the annoying update Discord pop-up on Linux. | |
| # Author: Urpagin | |
| # Date: 2025-07-15 | |
| # Multiline command | |
| command -v jq >/dev/null 2>&1 && \ | |
| f="$HOME/.config/discord/settings.json" && \ |
NewerOlder