Post your handy utility scripts!

Hey, I paid for that CPU so I want to use every damn cpu core/thread it has. :stuck_out_tongue_winking_eye:


You were warned… :upside_down_face:



The best thing about arrays is that they occupy a contiguous part of memory, which makes makes it possible to access any element by its index. It takes the same amount of time to read item 0 and item 10000, you don’t have to iterate through all of the array to find the element at a given position. In CS jargon, this makes the array a β€œrandom access data structure”, and the time it takes to access any element is said to be O(1) (it does not depend on the position of the element nor the size of the array).

So in β€œmy method”, getting a random element from the array does not depend on the size of that array (though the probability distribution is bugged with big arrays). You just get the random index, and then access the element at that position. A single array access operation.

On the other hand, shuffling the array (with the best possible algorithm and sufficient memory) requires O(n) time, where n is the size of the array, meaning that 10 times bigger array takes 10 times longer to shuffle. Every element in the array has to be accessed at least once to shuffle it. Now, if you combine that with calling a (rather bloated) external program like sed on every element of the array… this is where you lose all that time.


Here is the best alias ever:

alias 🐱='cat'

It works flawlessly.


Isn’t that dangerous to a frog? I had to restrict my cat to the house when at the lake…


1 Like

An Arch TU told me about this:

It brought my system into the 21st century… :rofl:

$ πŸ¦„πŸŒˆ
zsh: command not found: πŸ¦„πŸŒˆ


1 Like

Try 21st century B.C. :rofl:

c++ source code
#include <iostream>

#define π“‚˜ {
#define π“‚“ }
#define 𓂁 <<
#define π“‚„ >>
#define 𓇼 *
#define π“‹  +
#define π“ˆˆ =

#define π“­π“ƒŒπ“” std::cout
#define π“­π“ƒŒπ“… std::cin
#define 𓀑𓀽𓃩 int
#define π“ƒ½π“€Œπ“€“π“° char
#define π“œπ“‚€π“  template
#define π“­π“‰π“„™π“…Š class
#define π“…˜π“šπ“†« public
#define π“€ π“‰ π“Œ² const
#define π“Ήπ“Ž¬π“» return
#define π“†Œπ“†šπ“†£ auto
#define 𓄃𓃠 '\n'
#define 𓁩𓉒π“ͺ main

π“œπ“‚€π“  <π“­π“‰π“„™π“…Š 𓆦>
π“†Œπ“†šπ“†£ 𓁂𓇽𓁑(𓆦 π“€ π“‰ π“Œ² π“…‡, 𓆦 π“€ π“‰ π“Œ² π“…“) π“‚˜ π“Ήπ“Ž¬π“» π“…‡ π“‹  π“…“; π“‚“

π“œπ“‚€π“  <π“­π“‰π“„™π“…Š 𓆦>
π“­π“‰π“„™π“…Š π“‡£π“ˆŒπ“‚“
   π“œπ“‚€π“  <π“­π“‰π“„™π“…Š 𓋍>
   π“†Œπ“†šπ“†£ π“ƒšπ“ŒŒπ“‹Ήπ“…€(𓋍&& π“‹—, 𓆦 π“€ π“‰ π“Œ² π“…‡, 𓆦 π“€ π“‰ π“Œ² π“…“)
      π“Ήπ“Ž¬π“» π“‹—(π“…‡, π“…“);

𓀑𓀽𓃩 𓁩𓉒π“ͺ()
   π“‡£π“ˆŒπ“‚“<𓀑𓀽𓃩> π“……π“€Žπ“ƒ¦;
   𓀑𓀽𓃩 𓃕 π“ˆˆ π“……π“€Žπ“ƒ¦.π“ƒšπ“ŒŒπ“‹Ήπ“…€(𓁂𓇽𓁑<𓀑𓀽𓃩>, 1, 2);

   π“­π“ƒŒπ“” 𓂁 𓃕 𓂁 𓄃𓃠;

link to source


It would have been awesome if these were actual Middle Egyptian words, it’s just hieroglyphic gibberish. Still, very impressive!

I am no expert but I guess that the amount of people who are fluent both in c++ and Middle Egyptian could be counted on one hand even by a clumsy carpenter.
But then again, I may be surprised.


The user nobody is fluent in Middle Egyptian, the last native speaker of it died 3500 years ago. We can only guess how it sounded.

I’ve been learning it for 4-5 years now, and I know enough to be able to read hieroglyphic, but very slowly and with a help of a dictionary. I’ll never be fluent in it, unfortunately. But I find it really fun. So this combination of C++ and hieroglyphs is right up my alley :joy:


But - the really burning question is: Is there a :frog: hieroglyph? I know frogs were around then and there…

1 Like

Of course there is!

It’s glyph I7 in the Gardiner’s Sign List (glyph no. 7 under section I. Amphibious animals, reptiles, etc.).

There is also a tadpole, which is I8.

Frogs were very important in ancient Egyptian culture, religion, mysticism, and philosophy. They are symbols of fertility, childbirth, resurrection, and primeval times (before the creation of the universe). I could go on and on about this, but it’s quite off topic. :frog:

The Middle Egyptian word for frog was qrr, probably pronounced something like β€˜qurar’ (which is something a frog would say). Another onomatopoetic noun for an animal is mjw which means cat (probably pronounced β€˜miaw’).


Thank you! I learn the most interesting things here on the EnOS forum! :cat: :frog:


Absolutely beautiful! 𓋍&& is a work of art…

Here is a little script that generates mixed case:

# A sImPlE sCrIpt tHAt GeNErAtEs MiXed cAse FroM ItS STdIn


function coinflip() {
  printf $(($RANDOM%2))

while read line; do

  for ((i = 0; i < len; i++)); do

    if ((flip == oldflip)); then

    if ((n >= max_repeat)); then
      ((flip = !flip))

    if ((flip)); then
      printf '%s' "${uppercase_line:$i:1}"
      printf '%s' "${lowercase_line:$i:1}"

  printf '\n'
done < "${1:-/dev/stdin}"


$ ./mixcase <<< 'Just pipe text into it and it will create mixed case!'
jUsT pIpE tExt inTo iT aNd It wiLL cReaTe miXeD cASe!

Useful for most online interactions.

2023-08-23: Updated the script to not use sed, but instead use built-in Bash string manipulation techniques.


nice …

1 Like

Gnome disable lid switch / enable lid switch:

#!/usr/bin/env bash

if [[ "$1" == "1" ]]; then
    kill -9 ` pgrep -f gnome-tweak-tool-lid-inhibitor`
    echo "Lid switch working"

if [[ "$1" == "0" ]]; then
    echo "Lid switch disabled"

if [[ "$1" == "" ]]; then
    echo "Usage:"
    echo "Disable lid switch - lidsw 0"
    echo "Enable lid switch - lidsw 1"

For when you are streaming a film and need to close your laptop lid :smiley: Quicker than tweaks…

How do you get the emoji’s quickly on the terminal?
I could think of opening emoji selector, searching, selecting(will copy it) and pasting it on the terminal, but is there any easier way? also helpful if not just in terminal but over the OS.
So far, I could be able to find this :

See @jonathon post:

It’s slightly finicky to get it to work, but once you do, it’s really nice.

When installed emojione-picker.

$ yay emojione-picker-git

You can do

$ emojione-picker --help

From there you can select an emoji :slight_smile:

Just found out myself.

edit typo