Hey, I paid for that CPU so I want to use every damn cpu core/thread it has.
You were warnedβ¦
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β¦
An Arch TU told me about this: https://wiki.archlinux.org/title/IBus#Emoji_input
It brought my system into the 21st centuryβ¦
$ π¦π
zsh: command not found: π¦π
Try 21st century B.C.
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);
πππ π π π ππ ;
π
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
But - the really burning question is: Is there a hieroglyph? I know frogs were around then and thereβ¦
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.
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!
Absolutely beautiful! π&&
is a work of artβ¦
Here is a little script that generates mixed case:
#!/bin/bash
# A sImPlE sCrIpt tHAt GeNErAtEs MiXed cAse FroM ItS STdIn
max_repeat=2
function coinflip() {
printf $(($RANDOM%2))
}
while read line; do
uppercase_line="${line^^}"
lowercase_line="${line,,}"
len=${#line}
flip=$(coinflip)
n=0
for ((i = 0; i < len; i++)); do
oldflip=$flip
flip=$(coinflip)
if ((flip == oldflip)); then
((n++))
fi
if ((n >= max_repeat)); then
n=0
((flip = !flip))
fi
if ((flip)); then
printf '%s' "${uppercase_line:$i:1}"
else
printf '%s' "${lowercase_line:$i:1}"
fi
done
printf '\n'
done < "${1:-/dev/stdin}"
Usage:
$ ./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 β¦
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"
fi
if [[ "$1" == "0" ]]; then
/usr/lib/gnome-tweak-tool-lid-inhibitor&
echo "Lid switch disabled"
fi
if [[ "$1" == "" ]]; then
echo "Usage:"
echo "Disable lid switch - lidsw 0"
echo "Enable lid switch - lidsw 1"
fi
For when you are streaming a film and need to close your laptop lid 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 : https://hub.espanso.org/packages/all-emojis/#
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
Just found out myself.
edit typo