Tricks – Paolo Redaelli https://monodes.com/predaelli A civil engineer with a longlife fondness for Software Libero Mon, 02 Jun 2025 15:54:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 91795679 Convertire documenti (con Python ma non solo) https://monodes.com/predaelli/2025/06/02/convertire-documenti-con-python-ma-non-solo/ https://monodes.com/predaelli/2025/06/02/convertire-documenti-con-python-ma-non-solo/#respond Mon, 02 Jun 2025 15:54:17 +0000 https://monodes.com/predaelli/?p=13492 Molto apprezzabile e sintetico Convertire documenti con Python di Magnetismo.

]]>
https://monodes.com/predaelli/2025/06/02/convertire-documenti-con-python-ma-non-solo/feed/ 0 13492
The fastest USB https://monodes.com/predaelli/2025/06/01/the-fastest-usb/ https://monodes.com/predaelli/2025/06/01/the-fastest-usb/#respond Sun, 01 Jun 2025 11:05:03 +0000 https://monodes.com/predaelli/2025/06/01/the-fastest-usb/ The fastest USB key are not normal memory sticks but SD cards of a decent class with an USB-C 3.1 adapter

This is the suggestion from Davide Depau, found running several benchmarks with EtchDroid

SD cards are made to put them in cameras and it’s not uncommon to get 300 MB/s write even with a phone.

The slower ones do 100 MB/s on average

Whereas I haven’t found a way to get consistently fast USB sticks. The more expensive ones are generally better but not always. On average, flash drives do not do more than 70 MB/s and after a while they drop even slower when they run out of cache. So do SD cards, but they generally have bigger caches and hardly fill it up with the ISO of arch

Also, in the last 10 years I have noticed (empirically) a substantial improvement in the durability of SD cards. 10 years ago half of even branded SD cards would die on me, now even the ones from the fucking sub-brand on Amazon are OK

]]>
https://monodes.com/predaelli/2025/06/01/the-fastest-usb/feed/ 0 13481
Saturating the name-space https://monodes.com/predaelli/2025/05/16/saturating-the-name-space/ https://monodes.com/predaelli/2025/05/16/saturating-the-name-space/#respond Fri, 16 May 2025 16:02:40 +0000 https://monodes.com/predaelli/?p=13371 We are saturating the name space for programming languages. These days I discovered the Odin Programming Language “”The Data-Oriented Language for Sane Software Development.According to its FAQs there are some things we may learn for Eiffel.

Its guiding principles are

  • Simplicity and readability
  • Minimal: there ought to be one way to write something
  • Striving for orthogonality
  • Programs are about transforming data into other forms of data
    • Code is about expressing algorithms—not the type system
  • There is embedded knowledge and wisdom in older programming languages
  • The entire language specification should be possible to be memorized by a mere mortal

Its featre are features (in no particular order):

  • Full UTF-8 Support
  • Custom allocators that are simple to use:
    • Memory arenas/regions, pools, stacks, etc. which can be easily added
  • Context system for allocations, logging, and thread data
  • Built-in types and procedures that take advantage of the context system:
    • new(type), and make use the context’s allocator (unless explicitly given)
    • Dynamic arrays and hash maps ([dynamic]int and map[string]int)
  • Array programming
    • a, b: [4]f32; c := a * b
    • i := a.x * b.y
    • v := swizzle(a, 1, 2, 0)
  • Explicit procedure overloading
  • Introspection on all types
  • High control over memory layout
    • Alignment
    • Field offsets
    • Endianness
    • Data sizes
  • Endian specific integer types (useful for specific data formats)
    • u32le
    • u64be
  • Decent package system and file handling
  • No bad preprocessor
  • Type inference
    • x: int = 1
    • x := 1 // x is deduced to be an int
  • using
    • making everything a namespace (similar to Pascal’s with but on steroids)
    • Ability to have subtype polymorphism
  • Multiple return values
  • Clean, consistent, and fast to parse syntax
  • No need for procedure prototypes
  • defer statements
    • defer a statement until the end of scope (akin to D’s scope(exit))
  • Nested procedures and types
  • Tagged unions and untagged unions
  • Ranged for loops
  • Labelled branches
    • break label_name
  • break by default in switch statements
    • Explicit fallthrough
  • “Raw” strings
    • x := `what "the" string?`
  • cstring for legacy use
  • Parametric polymorphism (“generics”)
  • Foreign system
  • Compile time when statements
  • Bounds checking which is togglable at the statement level:
    • #no_bounds_check #bounds_check
  • i128 and u128 support

And lots more!

]]>
https://monodes.com/predaelli/2025/05/16/saturating-the-name-space/feed/ 0 13371
Camminare per dimagrire: 9 segreti per bruciare davvero i grassi https://monodes.com/predaelli/2025/04/12/camminare-per-dimagrire-9-segreti-per-bruciare-davvero-i-grassi/ https://monodes.com/predaelli/2025/04/12/camminare-per-dimagrire-9-segreti-per-bruciare-davvero-i-grassi/#respond Fri, 11 Apr 2025 22:04:57 +0000 https://monodes.com/predaelli/?p=13085

Camminare per dimagrire: 9 segreti per bruciare davvero i grassi

Camminare è il miglior modo per dimagrire, ma occorre rispettare alcune regole: 9 consigli per bruciare davvero i grassi senza soffrire.

]]>
https://monodes.com/predaelli/2025/04/12/camminare-per-dimagrire-9-segreti-per-bruciare-davvero-i-grassi/feed/ 0 13085
Telegram emoji list with codes and descriptions – K3A https://monodes.com/predaelli/2025/03/26/telegram-emoji-list-with-codes-and-descriptions-k3a/ https://monodes.com/predaelli/2025/03/26/telegram-emoji-list-with-codes-and-descriptions-k3a/#respond Wed, 26 Mar 2025 15:22:46 +0000 https://monodes.com/predaelli/?p=12998

After almost 2 years of using Telegram, I finally discovered that it is possible to enter emoji using its name after “:” character. Unfortunately I couldn’t find any complete list of available emojis anywhere, so I had to dig deep into the Telegram desktop source code to generate it. It was far more complicated than

Code changes and relevant files are available in this repo: https://github.com/k3a/telegram-emoji-list.

Source: Telegram emoji list with codes and descriptions – K3A

]]>
https://monodes.com/predaelli/2025/03/26/telegram-emoji-list-with-codes-and-descriptions-k3a/feed/ 0 12998
Applicazioni da remoto https://monodes.com/predaelli/2025/03/07/applicazioni-da-remoto/ https://monodes.com/predaelli/2025/03/07/applicazioni-da-remoto/#respond Fri, 07 Mar 2025 16:54:52 +0000 https://monodes.com/predaelli/?p=12923 Oh, dimenticavo di aver già scritto di waypipe, a proposito dei giochi 3d. Quasi 5 anni fa!

Ora la parte noiosa. Spesso mi collego (con ssh, ça va san dire) alle mie macchine di casa da remoto dove è già attiva una sessione “desktop” che oggigiorno è Wayland. Così qualsiasi programma Gnome o che usa le librerie Gtk – cioè moltissimi – verrà visualizzato sul desktop Wayland e non sul dektop remoto.

waypipe ssh $HOST” funziona a meraviglia, ma l’aggiunta di queste righe al vostro .bashrc è utile quando non state usando una sessione Wayland (cioè Windows):

if [ -n "$SSH_CLIENT" ]; then
  if [ -n "$WAYLAND_DISPLAY" ]; then
    echo "Remote session with waypipe, everything will be OK" 
  else 
    echo "Remote session, forcing GTK to X11"
    export GDK_BACKEND=x11
  fi
fi

]]>
https://monodes.com/predaelli/2025/03/07/applicazioni-da-remoto/feed/ 0 12923
Network transparency with Wayland (bis) https://monodes.com/predaelli/2025/03/07/network-transparency-with-wayland-bis/ https://monodes.com/predaelli/2025/03/07/network-transparency-with-wayland-bis/#respond Fri, 07 Mar 2025 16:54:29 +0000 https://monodes.com/predaelli/?p=12922 Oh, I forgot I already wrote about waypipe, regarding 3d games. Almost 5 years ago!

Now the boring part. If you log into a machine where a Wayland session is already active – I often log into my home machines remotely – any Gtk program will show on the Wayland desktop. So you use “waypipe ssh $HOST” which is cool and works like a breeze but adding those lines to your .bashrc helps when you are not using a wayland session (i.e. Windows):

if [ -n "$SSH_CLIENT" ]; then
  if [ -n "$WAYLAND_DISPLAY" ]; then
    echo "Remote session with waypipe, everything will be OK" 
  else 
    echo "Remote session, forcing GTK to X11"
    export GDK_BACKEND=x11
  fi
fi

]]>
https://monodes.com/predaelli/2025/03/07/network-transparency-with-wayland-bis/feed/ 0 12922
How to download all PDF files linked from a single page using wget https://monodes.com/predaelli/2025/03/06/how-to-download-all-pdf-files-linked-from-a-single-page-using-wget/ https://monodes.com/predaelli/2025/03/06/how-to-download-all-pdf-files-linked-from-a-single-page-using-wget/#respond Thu, 06 Mar 2025 17:58:00 +0000 https://monodes.com/predaelli/?p=12892

You can use wget to download all PDFs from a webpage by using:

wget -r -l1 -H -t1 -nd -N -np -A.pdf -erobots=off --wait=2 --random-wait --limit-rate=20k [URL]
  • -r: Recursive download.
  • -l1: Only one level deep (i.e., only files directly linked from this page).
  • -H: Span hosts (follow links to other hosts).
  • -t1: Number of retries is 1.
  • -nd: Don’t create a directory structure, just download all the files into the current directory.
  • -N: Turn on timestamping.
  • -np: Do not follow links to parent directories.
  • -A.pdf: Accept only files that end with .pdf.
  • -erobots=off: Ignore the robots.txt file (use carefully, respecting site’s terms and conditions).
  • –wait=2: Wait 2 seconds between each retrieval.
  • –random-wait: Wait from 0.5 to 1.5 * –wait seconds between retrievals.
  • –limit-rate=20k: Limit the download rate to 20 kilobytes per second.

This parameters will avoid the “429: Too Many Requests” error.

Source: How to download all PDF files linked from a single page using wget

]]>
https://monodes.com/predaelli/2025/03/06/how-to-download-all-pdf-files-linked-from-a-single-page-using-wget/feed/ 0 12892
imagemagick reduce size of pdf https://monodes.com/predaelli/2025/03/04/imagemagick-reduce-size-of-pdf/ https://monodes.com/predaelli/2025/03/04/imagemagick-reduce-size-of-pdf/#respond Tue, 04 Mar 2025 00:36:53 +0000 https://monodes.com/predaelli/?p=12887

convert -density 150 -quality 60 -compress jpeg Test.pdf Test-150-060-jpeg.pdf

Source: imagemagick reduce size of pdf – Stack Overflow

]]>
https://monodes.com/predaelli/2025/03/04/imagemagick-reduce-size-of-pdf/feed/ 0 12887
How to add a directory to your PATH https://monodes.com/predaelli/2025/02/24/how-to-add-a-directory-to-your-path/ https://monodes.com/predaelli/2025/02/24/how-to-add-a-directory-to-your-path/#respond Mon, 24 Feb 2025 19:19:00 +0000 https://monodes.com/predaelli/?p=12856 How to add a directory to your PATH? I naïvely answered export PATH=A_DIRECTORY:$PATH

Well, after reading How to add a directory to your PATH written by Julia Evans I know that it is not as simple as it seems!

]]>
https://monodes.com/predaelli/2025/02/24/how-to-add-a-directory-to-your-path/feed/ 0 12856