Skip to content

Instantly share code, notes, and snippets.

@rindeal
rindeal / !gsettings-array.py.md
Last active May 15, 2024 10:05
GSettings array manipulation made easy from CLI. Implements ls, insert, pop, rm, sort and dedup operations

GSettings Array Manipulator

Welcome to the GSettings Array Manipulator, a powerful command-line tool designed to simplify and streamline your interactions with GSettings arrays. With this tool, you can perform a variety of tasks, from inserting items into an array to sorting and deduplicating items, all with a few simple commands.

Features

  • Insert: Add one or more items to your array at a specified index.
  • List: Display all items in your array, each on a new line.
  • Sort: Sort all items in your array.
  • Deduplicate: Remove duplicate items from your array.
@rindeal
rindeal / buffered_io_get_buffer_size.py
Last active May 13, 2024 06:41
Python 3 function to calculate optimal buffer size for any io.BufferedIOBase subclass, like io.BufferedReader and io.BufferedWriter
"""
===============================
BufferedIOBase Buffer Size Calculator
===============================
This Python script contains a function `buffio_get_buffsz` that calculates
the buffer size of a `BufferedIOBase` object.
Functionality
=============
@rindeal
rindeal / !xkb-list-layouts-variants.sh.md
Last active May 13, 2024 01:28
POSIX shell functions and CLI utility to print/list all XKB layouts and their variants including "exotic" ones. Much improved replacement for "localectl"'s "list-x11-keymap-layouts" and "list-x11-keymap-variants" commands.

XKB Layouts and Variants List

Welcome to the home of the ultimate tool for listing all XKB layouts and their variants, including those rare and "exotic" ones. This POSIX shell script and CLI utility is a much-improved alternative to "localectl"'s "list-x11-keymap-layouts" and "list-x11-keymap-variants" commands.

Versatile and Easy to Use

This script is designed with versatility in mind. It can be used in two ways:

  1. As a standalone script which acts as a CLI utility.
  2. As a module with functions that can be sourced and used inside some other script.
@rindeal
rindeal / !gsettings-array.py.md
Last active May 13, 2024 03:45
GSettings array manipulation made easy from CLI. Implements ls, insert, pop, rm, sort and dedup operations
We couldn’t find that file to show.
@rindeal
rindeal / curl-timing-write-out-format
Created September 10, 2020 20:27
curl timing --write-out format
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
@rindeal
rindeal / hash-multi-n-print-markdown-table.sh
Last active March 17, 2024 01:30
Generate multiple hashes for a file and print them as a markdown table
#!/bin/sh
# requires `pee` command from `moreutils` suite
SUMS=(
md5sum
sha1sum
sha256sum
)
FILE="${1}"
printf '<details>\n'
@rindeal
rindeal / .gitattributes
Last active May 12, 2024 09:02
Structure/format defintion of a .res file archive (`Geometry.res` and `Textures.res`) from the game "The I of The Dragon" for use in "Hex Editor Neo" and "ImHex" software
*.pat linguist-language=Rust
*.hexpat linguist-language=Rust
@rindeal
rindeal / lockup_timer.c
Created August 19, 2018 22:09
Lockup Timer
#include "lockup_timer.h"
#define PRINT_ERR(fmt, ...) \
fprintf(stderr, "%s:%d:%s(): " fmt, \
__FILE__, __LINE__, __func__, \
__VA_ARGS__)
#include <stdio.h> /* fprintf */
#include <errno.h> /* errno */
@rindeal
rindeal / gen.py
Last active August 16, 2018 16:02
MIN MAX __VA_ARGS__
#!/usr/bin/env python3
# Python-Version-Compatibility: 3.6
##
# Copyright (C) 2018 Jan Chren (rindeal)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
@rindeal
rindeal / pp_narg.h
Last active August 16, 2018 16:03
PP_NARG
/**
* Copyright (C) 2018 Jan Chren (rindeal)
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the