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 python3 | |
# SPDX-FileCopyrightText: ANNO DOMINI 2024 Jan Chren (rindeal) <dev.rindeal(a)gmail.com> | |
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only | |
import sys | |
assert sys.version_info >= (3, 11) | |
import argparse |
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
#!/bin/sh | |
# SPDX-FileCopyrightText: ANNO DOMINI 2024 Jan Chren (rindeal) <dev.rindeal(a)gmail.com> | |
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only | |
# NOTE: Developed for xkbcli 1.5.0, might not work with later versions | |
xkb_list_layouts() | |
{ | |
xkbcli list --load-exotic | \ |
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
int64_t | |
GCD(int64_t const a, int64_t const b) | |
{ | |
register int64_t rt, r0 = a, r1 = b; // remainder | |
while (r1 != 0){ | |
// classic Euclidean algorithm | |
rt = r1; | |
r1 = r0 % r1; | |
r0 = rt; |
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
#!/bin/sh | |
sudo sysdig -p '%proc.name|%evt.arg.fd.name' \ | |
'evt.dir=> and ( fd.type=file or fd.type=directory ) and fd.name!=""' | \ | |
awk -F\| ' | |
BEGIN{ | |
OFS="|" | |
} | |
$2!~/^<f>\/(dev|proc|run|sys).*/ { | |
print $1,substr($2,4); |
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
#!/bin/bash | |
# based on https://stackoverflow.com/a/1438241/2566213 | |
# pure BASH solution | |
print_process_call_stack() { | |
local -a trace=() | |
local -- cmdline | |
local -i pid=$$ ppid |
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 python3.6 | |
## | |
# Copyright 2018 Jan Chren (rindeal) | |
# Distributed under the terms of the GNU General Public License v3 | |
## | |
class _FilesAndDirsGen: | |
_root_tmpdir: tempfile.TemporaryDirectory | |
_defs: typing.Union[dict, set] |
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
# SPDX-FileCopyrightText: 2018 Jan Chren (rindeal) | |
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only | |
import pathlib | |
import urllib | |
import shutil | |
import tarfile | |
def fetch_tar(url: str, dest_dir: pathlib.Path, clean_dest: bool = False, strip_components: int = 0): | |
if clean_dest and dest_dir.exists(): |
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
#!/bin/sh | |
# requires `pee` command from `moreutils` suite | |
SUMS=( | |
md5sum | |
sha1sum | |
sha256sum | |
) | |
FILE="${1}" | |
printf '<details>\n' |
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
#if !defined(__GNUC__) || ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800) | |
# error "This program requires GNU C compiler v4.8+!" | |
#endif | |
#include <stdio.h> | |
#include <stdbool.h> | |
#define PRINT_TEST_CPU_SUPPORT_RESULT(inst) printf("\t%-7s: %d\n", inst, __builtin_cpu_supports(inst)?1:0) | |
#define PRINT_TEST_CPU_TYPE_RESULT(inst) printf("\t%-12s: %d\n", inst, __builtin_cpu_is(inst)?1:0) |
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
# -------------------------------------------------------------------------------------------------# | |
# # | |
# _ _ _ _ __ ___ _____ _ _ __ _ # | |
# | | | |_ _ __ _ _ _ _ __| |_(_)/ _|_ _ / __| / / __|| |_ _| |_ __ ___ _ _ / _(_)__ _ # | |
# | |_| | ' \/ _| '_| || (_-< _| | _| || | | (__ / / (_|_ _|_ _| / _/ _ \ ' \| _| / _` | # | |
# \___/|_||_\__|_| \_,_/__/\__|_|_| \_, | \___/_/ \___||_| |_| \__\___/_||_|_| |_\__, | # | |
# |__/ |___/ # | |
# # | |
# -------------------------------------------------------------------------------------------------# | |
# # |
NewerOlder