The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘Perl’ Category

bash alias to decode email Quoted-Printable stdin data

Posted by jpluimers on 2025/09/25

Perl isn’t my strength, so I was glad to find the below links that inspired me to add this bash function to my profile decoding Quote-Printable email data (for instance used by sendmail and postfix to store SMTP message files):

# https://superuser.com/questions/1452249/fix-revert-wrong-encoding-of-file
function sendmail-decode-quoted-printable-from-stdin() {
  perl -0777 -ne 'use MIME::QuotedPrint; print decode_qp($_)'
}

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, bash, Development, Perl, Power User, Python, Scripting, sendmail, Software Development | Leave a Comment »

Alan Turing Wrote Object-Oriented Code In C And Ran It On BEAM – De Programmatica Ipsum

Posted by jpluimers on 2025/07/16

I originally missed this as back then I was in the midst of managing trouble in my parental family, unaware I was already having rectum cancer. Then things went fast, not even including the Covid-19 years, so I was glad last year I got reminded of this mid-2019 article:

[Wayback/Archive] Alan Turing Wrote Object-Oriented Code In C And Ran It On BEAM – De Programmatica Ipsum writes a lot of interesting things on programming paradigms, starting with

In his rare 1994 book “Object-Oriented Programming In C” Axel Tobias Schreiner explains how to do inheritance, class methods, class hierarchies, and even how to raise exceptions using nothing else than pure, simple, pointer arithmetic-filled, ANSI C.

then arguing basically most of not all modern languages share the majority of programming paradigms and all these paradigms are repeats of the past:

These days, we are using the offsprings of multiple programming paradigms having unprotected sex with one another in a thoughtful orgy. PHP, C#, Perl, C++ and even Visual Basic have all closures, lambdas or anonymous functions now. F# and Scala can instantiate any class included in their corresponding vendor-provided frameworks. JavaScript implements functions as objects with a single method .call(). Haskell comonads are actually objects. Swift 1.0 implemented instance methods as curried functions.
But none of this is new. Smalltalk, arguably the precursor of object orientation, had collect and select methods which were the grandparents of our more common map and filter functional friends.

What sets modern languages apart is that they the majority covers all the paradigms you might need, just differing in how well they support the paradigm-du-jour.

It means programming language wars should have been a thing of the past for about two decades now.

Please let that sink in.

 

Oh: if you look for that ANSI C book, here it is: [Wayback/Archive] https://www.cs.rit.edu/~ats/books/ooc.pdf [Wayback PDF View/PDF View]

 

Via: [Wayback/Archive] De Programmatica Ipsum: “”In his rare 1994 book “Object…” – mas.to

--jeroen

Posted in .NET, C, C#, C++, Cloud, COBOL, Containers, Design Patterns, Development, Docker, Erlang, F#, Go (golang), Haskell, Infrastructure, Java, Java Platform, Kotlin, Kubernetes (k8n), ObjectiveC, OOP (Object Oriented Programming), Perl, Scala, Scripting, Software Development, Swift, VB.NET | Leave a Comment »

GitHub – randomaccess3/googleURLParser: parser for Google search strings

Posted by jpluimers on 2025/05/01

Back when I observed the Google Search sei parameter which I hadn’t seen before yet, I bumped into [Wayback/Archive] GitHub – randomaccess3/googleURLParser: parser for Google search strings

It covers a truckload of parameters, including the sei one, which isn’t as new as I thought, as it was at least 2017 old: [Wayback/Archive] [Neat URL] Yet another Google parameter… · Issue #25 · Smile4ever/firefoxaddons · GitHub

Links referred from the parser tool for further reading:

Read the rest of this entry »

Posted in Development, Google, GoogleImageSearch, GoogleSearch, Perl, Power User, Python, Scripting, Software Development | Tagged: | Leave a Comment »

Ungendered writing – #awareness

Posted by jpluimers on 2025/03/14

Maybe the outcome of this research study is even more reason to promote awareness around ungendered writing.

In this world at large, inclusivity should be the norm and showing that in your writing should increase funding rates for science articles.

[Wayback/Archive] Ungendered writing: Writing styles are unlikely to account for gender differences in funding rates in the natural and technical sciences – ScienceDirect.

Read the rest of this entry »

Posted in Awareness, Development, Inclusion / inclusive society, Perl, Python, Scripting, Software Development | Leave a Comment »

Old programming books had cool little “puns” in their references, modern lack them in their indices. On the why, and history of them.

Posted by jpluimers on 2025/01/01

I wrote a two earlier blog posts around puns in programming book indices before:

  1. the 1992 Turbo Pascal 7.0 Language Guide having both entry in the manual about Recursion (“recursive loop, see recursive loop”) which of course is similar to “infinite loop” and entries for “infinite loop See loop, infinite” and “loop, infinite See infinite loop”.
  2. infinite loop in “LaTeX: A Document Preparation System” by Leslie Lamport, printed in 1994.

In the last one, I promised to list more occurrences which I now finally had time for to do.

But let me first elaborate more on the observation that modern computer books (like for instance on C# and Delphi beyond version 1) lack these kinds of index pun.

On the Delphi side, the index entry joke for recursion got removed no later than Delphi 3 (I am still looking for a Delphi 2 version of the Object Pascal Language Guide, see further below) even before the book being fully redone electronically and the index pages generation being automated in

I think I even understand why that is: the process of creating of indices. By the start of this century, more and more indices were automatically being generated and for the last 2 decades or so, all of them are. Back in the days however, indices were mostly done by hand. Nowadays, with everything automated, it is actually pretty tricky in most environments to add such an “infinite loop” index entry like in the Turbo Pascal book, as it would require two things at once:

Read the rest of this entry »

Posted in .NET, C, C#, C++, Conference Topics, Conferences, Delphi, Delphi 1, Delphi 2, Development, EKON, Event, History, LaTeX, LifeHacker, LISP, Mathematics, Pascal, Perl, PL/I (a.k.a. PL/1), Power User, science, Software Development, Turbo Pascal, Typesetting | Tagged: , | 4 Comments »

llamasoft/polyshell: A Bash/Batch/PowerShell polyglot!

Posted by jpluimers on 2023/03/16

PolyShell is a script that’s simultaneously valid in Bash, Windows Batch, and PowerShell (i.e. a polyglot).

[Wayback/Archive] llamasoft/polyshell: A Bash/Batch/PowerShell polyglot!

Need to check this out, as often I have scripts that have to go from one language to the other or vice versa.

Maybe it enables one language to bootstrap functionality in the other?

The quest

The above polyglot started with a quest to see if I can could include some PowerShell statements in a batch file with two goals:

  1. if the batch file started from the PowerShell command prompt, then execute the PowerShell code
  2. if the batch file started from the cmd.exe command prompt, then have it start PowerShell with the same command-line arguments

The reasoning is simple:

  1. PowerShell scripts will start from the PATH only when PowerShell is already running
  2. Batch files start from the path when either cmd.exe or PowerShell are running

Lots of users still live in the cmd.exe world, but PowerShell scripts are way more powerful, and since PowerShell is integrated in Windows since version 7, so having a batch file bootstrap PowerShell still makes sense.

Since my guess was about quoting parameters the right way, my initial search for the link below was [Wayback/Archive] powershell execute statement from batch file quoting – Google Search.

I have dug not yet into this, so there are still…

Many links to read

These should give me a good idea how to implement a polyglot batch file/PowerShell script.

–jeroen

Posted in *nix, *nix-tools, bash, bash, Batch-Files, Development, JavaScript/ECMAScript, Perl, Polyglot, Power User, PowerShell, Scripting, Software Development | Leave a Comment »

Google Cloud Shell: tools, languages and “safe mode”

Posted by jpluimers on 2023/01/19

After publishing Free Linux cloud shell for Gmail users – shell in the browser that works in all locations I’ve been so far, the Google Cloud Shell got extended quite a bit.

There is now [Wayback/Archive] Safe Mode (which skips initialisation scripts):

If there’s a problem in your .bashrc or .tmux.conf files, Cloud Shell immediately close after connection. To resolve this, open Cloud Shell in safe mode by appending cloudshellsafemode=true to the URL. This restarts your Cloud Shell instance and logs you in as root, allowing you to fix any issues in the files.

To permanently delete all files in your home directory and restore your Cloud Shell home directory to a clean state, you can reset your Cloud Shell VM.

And there is support for way more [Wayback/Archive] tools and languages:

Read the rest of this entry »

Posted in .NET, C#, Cloud, Development, Go (golang), Google, GoogleCloudShell, Infrastructure, Java, Java Platform, JavaScript/ECMAScript, Node.js, Perl, PHP, Power User, Python, Ruby, Scripting, Software Development | Leave a Comment »

Kristian Köhntopp on Twitter: “Basically, show me a Python regex with \d and without ASCII flag, and I can show you a bug, often exploitable.… “

Posted by jpluimers on 2022/12/14

An interesting thought: [Archive] Kristian Köhntopp on Twitter: “Basically, show me a Python regex with \d and without ASCII flag, and I can show you a bug, often exploitable.… “

Basically, input parsing is still very much underrated by most systems and a constant source of peculiarities and therefore bugs, or phrased differently: [Archive] Kristian Köhntopp on Twitter: “In many cases an uncaught exception, and hence a component crash.… “

Kris also states [Archive] Kristian Köhntopp on Twitter: “Again, Python is not alone in this. Perl, when “use utf8;” is active (which it should) also does this, so every single fucking Regex needs a ‘/a‘ at the end. Nobody ever asked \d to match tengwar or klingon numeric symbols.… “.

The point is in the last few words as Arabic numerals are so white spread over the world that the ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9 they represent should be the de facto \d pattern, but aren’t in Python as per [Wayback/Archive] re — Regular expression operations — Python 3.10.0 documentation: /d (emphasis mine):

Read the rest of this entry »

Posted in Development, Perl, Python, RegEx, Scripting, Software Development | Leave a Comment »

Wake-on-LAN from a Windows machine

Posted by jpluimers on 2022/06/02

Before digging into Wake-on-LAN on Windows machines, I’ll interlude with basically the canonical wakonlan available on many non Windows machines

On Linux and BSD machines, there is the Perl script wakeonlan (steadily at version 0.41) at [Wayback/Archive.is] jpoliv/wakeonlan: Perl script for waking up computers via Wake-On-LAN magic packets (script: [Wayback/Archive.is] wakeonlan/wakeonlan at master · jpoliv/wakeonlan) with this help:

Read the rest of this entry »

Posted in *nix, *nix-tools, Development, Perl, Power User, Scripting, Software Development, Windows | Leave a Comment »

Zypper: list info on all patterns, so you can find out which pattern provides a package

Posted by jpluimers on 2022/05/11

I wanted to know which pattern provides [WayBack] etckeeper which is in the [WayBack] openSUSE Software package etckeeper.

It seems no built-in search query can do that, so I built one my own.

Since the result takes quite a while to produce, the output is a pattern.txt that you can manually search.

This is the command:

zypper search -t pattern | grep "|" | tail -n +2 | perl -pe 's/^.*? \| //' | perl -pe 's/ *\| .*$//' | xargs -I {} sh -c "zypper info -t pattern {}" > patterns.txt

The content is like this (the 2017 date shows I wrote this a long time ago):

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, bash, Development, etckeeper, Linux, Perl, Power User, Scripting, sed, Software Development | Leave a Comment »