Un naufragio personal

Ángel Ortega

Three wrappers to run commands without impacting the rest of the system

François Marier names 3 tools to execute other commands with lower priorities on a Linux system:

nice
Runs at a "nicer" (i.e. lower) CPU priority (a UNIX classic that everybody knows).
ionice
Sets the I/O priority. Interesting options are -c3 (needs root) or -n7. Only useful if you are using the CFQ scheduler.
nocache
Avoids storing files into the file cache, leaving it ready for other running processes.

Example in a crontab:

0 0 * * * nocache ionice nice /path/to/backup.sh

https://feeding.cloud.geek.nz/posts/three-wrappers-to-run-commands-without-impacting-the-rest-of-the-system/

Sending data in a signal

Craig said on sending additional data or context in a UNIX signal:

"[...] One thing that isn’t as well known is besides sending a signal to a process, you can send some data to it. This can either be an integer or a pointer and uses similar semantics to the known kill and signal handler. [...]"

The key is using sigqueue() instead of signal() and a signal handler like:

void signal_handler(int signum, siginfo_t *siginfo, void *ucontext)
{
    if (signum != SIGUSR1) return;
    if (siginfo->si_code != SI_QUEUE) return;
 
    printf("receiver: Got value %d\n", siginfo->si_int);
}

https://dropbear.xyz/2020/04/29/sending-data-in-a-signal/

Using GnuPG for SSH authentication

The GnuPG agent can be used as an SSH agent:

https://incenp.org/notes/2015/gnupg-for-ssh-authentication.html

Gimme gimme gimme

If you execute the Linux man command without arguments, it returns:

What manual page do you want?

But, if you do the same exactly at 00:30, the returned message is:

gimme gimme gimme

Of course, this is after ABBA's song Gimme Gimme Gimme A Man After Midnight.

In defence of swap: common misconceptions

Chris Down says (on anonymous, i.e. allocated memory pages):

"[...] Swap is a storage area for these seemingly "unreclaimable" pages that allows us to page them out to a storage device on demand. This means that they can now be considered as equally eligible for reclaim as their more trivially reclaimable friends, like clean file pages, allowing more efficient use of available physical memory.

Swap is primarily a mechanism for equality of reclamation, not for emergency "extra memory". Swap is not what makes your application slow – entering overall memory contention is what makes your application slow."

https://chrisdown.name/2018/01/02/in-defence-of-swap.html

Remarkable StackExchange subdomains

The ReiserFS filesystem

"This document describes the ReiserFS filesystem structures on disk. It was created while writing a ReiserFS reader for Windows NT. I was unsatisfied with the documentation available over at the official URL, www.namesys.com, so I wrote my own. But, since this is my first contact with ReiserFS, it does contain errors, so if in doubt, please consult the original spec first."

"This document is copyrighted by Gerson Kurz and licensed by the GPL."

http://p-nand-q.com/download/rfstool/reiserfs_docs.html

Convert your ASCII diagram scribbles into happy little SVG

"Svgbob Editor - Convert your ASCII diagram scribbles into happy little SVG"

Not really limited to ASCII; Unicode is also supported (including special support for line drawing characters).

https://ivanceras.github.io/svgbob-editor/

An implementation of the ChaCha20 algorithm in Bash

This is an implementation of DJB's ChaCha20 algorithm in Bash script.

"chacha20.sh
by zx2c4
You probably shouldn't use this for anything."

https://git.zx2c4.com/chacha20.sh/tree/chacha20.sh

Old Book Illustrations

"Old Book Illustrations was born of the desire to share illustrations from a modest collection of books, which we set out to scan and publish."

https://www.oldbookillustrations.com/

Web Demo of the Voxel Space Engine

"Comanche uses a technique called Voxel Space, which is based on the same ideas like ray casting."

https://github.com/s-macke/VoxelSpace

The Voluntary Human Extinction Movement

"Phasing out the human race by voluntarily ceasing to breed will allow Earth’s biosphere to return to good health. Crowded conditions and resource shortages will improve as we become less dense.

[...]

Thank you for not breeding."

http://www.vhemt.org/

Kahan summation algorithm

Summary:

In numerical analysis, the Kahan summation algorithm, also known as compensated summation, significantly reduces the numerical error in the total obtained by adding a sequence of finite-precision floating-point numbers, compared to the obvious approach. This is done by keeping a separate running compensation (a variable to accumulate small errors).

https://en.wikipedia.org/wiki/Kahan_summation_algorithm

Stuff in Space

This site shows in real-time 3D the location of satellites and other celestial bodies:

http://stuffin.space/

You can search for specific units, like

http://stuffin.space/?intldes=2018-020A&search=PAZ

Sweden Solar System

"The Sweden Solar System is the world's largest permanent scale model of the Solar System. The Sun is represented by the Ericsson Globe in Stockholm, the largest hemispherical building in the world. The inner planets can also be found in Stockholm but the outer planets are situated northward in other cities along the Baltic Sea."

https://en.wikipedia.org/wiki/Sweden_Solar_System

A DOT file to ASCII converter

Rebuilding target files when source files have changed

Genius Daniel J. Bernstein wrote an extremely simple but brilliant specification for a make-like build system:

http://cr.yp.to/redo.html

He didn't release an implementation, but somebody apparently named apenwarr did it:

https://apenwarr.ca/log/20101214

Thanks to my friend @crappo for bringing this to my attention.

What Every Programmer Should Know About Floating-Point Arithmetic

A simple and to-the-point guide to floating point arithmetic and the crazy but genius IEEE-754 standard:

Well, this site is here to:

  • Explain concisely why you get that unexpected result
  • Tell you how to deal with this problem
  • If you’re interested, provide in-depth explanations of why floating-point numbers have to work like that and what other problems can arise

https://floating-point-gui.de/

The book is also on github.

Telegram Bot - how to get a group chat id?

apadana explains how to get a Telegram group chat id:

Here is the sequence that worked for me after struggling for several hours:

Assume the bot name is my_bot.

1- Add the bot to the group. Go to the group, click on group name, click on Add members, in the searchbox search for your bot like this: @my_bot, select your bot and click add.

2- Send a dummy message to the bot. You can use this example: /my_id @my_bot (I tried a few messages, not all the messages work. The example above works fine. Maybe the message should start with /)

3- Go to following url: https://api.telegram.org/botXXX:YYYY/getUpdates replace XXX:YYYY with your bot token

4- Look for "chat":{"id":-zzzzzzzzzz, -zzzzzzzzzz is your chat id (with the negative sign).

5- Testing: You can test sending a message to the group with a curl:

curl -X POST "https://api.telegram.org/botXXX:YYYY/sendMessage"
  -d "chat_id=-zzzzzzzzzz&text=my sample text"

If you miss step 2, there would be no update for the group you are looking for. Also if there are multiple groups, you can look for the group name in the response ("title":"group_name").

Hope this helps.

https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id

systemd now includes its own ntp service

Summary:

Uninstall ntp or chrony and do

sudo timedatectl set-ntp true

https://blog.steve.fi/_usr_bin_timedatectl.html