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 ‘*nix-tools’ Category

linux – Get final URL after curl is redirected – Stack Overflow (plus some Twitter scraping tricks)

Posted by jpluimers on 2025/08/06

Sometimes I need [Wayback/Archive] Redirect Checker | Check your Statuscode 301 vs 302 on the command-line, so cURL to the rescue: [Wayback/Archive] linux – Get final URL after curl is redirected – Stack Overflow. The relevant portions of answers and comments further below.

TL;DR:

Since I prefer verbose command-line arguments (you can find them at the [Wayback/Archive] curl – How To Use on-line man page) especially in scripts this HTTP GET request is what works with Twitter:

% curl --location --silent --output /dev/null --write-out "%{url_effective}\n" https://twitter.com/anyuser/status/20
https://x.com/anyuser/status/20

This failed (twitter dislikes HTTP HEAD requests):

% curl --head --location --silent --output /dev/null --write-out "%{url_effective}\n" https://twitter.com/anyuser/status/20
https://twitter.com/anyuser/status/20

Notes

Given so many of my scripts now run on zsh, I added the new-line because of command line – Why does a cURL request return a percent sign (%) with every request in ZSH? – Stack Overflow. You can strip that bit.

Note that these do not perform client side redirects, so they do not return the ultimate originating URL https://x.com/jack/status/20 (which was the first ever Tweet on what was back then called twttr) as Twitter on the client-side overwrites window.location.href with the final URL. Similar behaviour for getting the Twitter user handle of a Twitter user ID, more on Twitter tricks below.

Tweet by TweetID trick via [Wayback/Archive] Accessing a tweet using only its ID (and without the Twitter API) – Bram.us.

Further reading (thanks [Wayback/Archive] vise, [Wayback/Archive] Daniel Stenberg, [Wayback/Archive] Ivan, [Wayback/Archive] AndrewF, [Wayback/Archive] Roger Campanera, and [Wayback/Archive] Dave Baird):

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, Batch-Files, Bookmarklet, Communications Development, Conference Topics, Conferences, CSS, cURL, Development, Event, HTTP, Internet protocol suite, JavaScript/ECMAScript, Power User, Scripting, SocialMedia, Software Development, TCP, Twitter, Web Browsers, Web Development | Tagged: | Leave a Comment »

Windows: editing the RLU list of vncviewer.exe

Posted by jpluimers on 2025/08/04

Every now and then you make a typo when accessing remote systems through UltraVNC  vncviewer.exe (I did the worst: thinking I had hit Enter to select the most recent connection, but typing a password instead).

I could not find settings in the registry, nor a vncviewer.ini file, so I used Process Monitor and filtered all events for the most recently started vncviewer.exe to figure out where it would store configuration files.

Read the rest of this entry »

Posted in *nix, *nix-tools, Power User, VNC/Virtual_Network_Computing, Windows, Windows 10, Windows 11, Windows 7, Windows 8, Windows 8.1 | Leave a Comment »

command line – Why does a cURL request return a percent sign (%) with every request in ZSH? – Stack Overflow

Posted by jpluimers on 2025/07/31

I try to stay on the default shells of environments as much as possible, especially as that makes life easier when needing to work on an non-customised system.

Apple switched back from an ancient latest GPLv2 version 3.2 of bash (they regard newer GPLv3 as toxic to their revenue stream¹), introduced MIT-license based zsh and introduced a bash nag screen a few years ago forcing users to switch. Suppressing that message reliably is trickier than you might think².

After so many years of bash, I still stumble over things that zsh does differently: [Wayback/Archive] command line – Why does a cURL request return a percent sign (%) with every request in ZSH? – Stack Overflow (thanks [Wayback/Archive] Travis and [Wayback/Archive] zaTricky) is a “feature” with a simple workaround for cURL:

This is a zsh feature that prints a percent-and-newline after a command completes if that command does not already include a newline at the end of its output. If zsh did not do this, you would either not ever notice the fact that the command didn’t print a newline – or you’d see zsh’s command prompt not start on the margin and think it was a bug in zsh.

$ curl http://api.macvendors.com/0015c7   
Cisco Systems, Inc%     
$ curl -w '\n' http://api.macvendors.com/0015c7
Cisco Systems, Inc

Since the above example now writes a redirect messages (good bye HTTP, welcome HTTPS), and I very much dislike short command-line parameters, here is version with the long form of the [Wayback/Archive] curl -w or --write-out parameter :

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, bash, bash, Development, Mac OS X / OS X / MacOS, macOS 14 Sonoma, macOS 15 Sequoia, Power User, Scripting, Software Development, zsh | Leave a Comment »

unix – How come is this command returning “GET A LIFE!”? – Stack Overflow

Posted by jpluimers on 2025/06/11

Didn’t know nx had a scriptable RPN command-line calculator dc (for Desk Calculator) which does not seem to need white space characters in the input stream or input file.

It likely is a source for command-injection attacks given the question [Wayback/Archive] unix – How come is this command returning “GET A LIFE!”? – Stack Overflow, so I did a bit of digging and found this great platform:

Read the rest of this entry »

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

What is the Python 3 equivalent of “python -m SimpleHTTPServer” – Stack Overflow

Posted by jpluimers on 2025/05/29

Now that Python 2 has been dead for long enough (has it been unsupported for 5 years? yes it has: [Wayback/Archive] Status of Python Versions), it was finally time to change my alias for running a local web-server to serve files from a directory (:

So, from [Wayback/Archive] What is the Python 3 equivalent of “python -m SimpleHTTPServer” – Stack Overflow (thanks [Wayback/Archive] ryanbraganza, [Wayback/Archive] k.avinash and [Wayback/Archive] Petr Viktorin):

python -m http.server 8000, it will start the server on port 8000

Docs with the migration hints: [Wayback/Archive] 20.19. SimpleHTTPServer — Simple HTTP request handler — Python 2.7.18 documentation

Read the rest of this entry »

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

Interesting take by Florian Roth on Twitter: “First security application I install on … “” covering various platforms (both server and workstation) with tools that are easy and quick to install

Posted by jpluimers on 2025/05/26

[Wayback/Archive] Florian Roth on Twitter: “First security application I install on … macOS: LittleSnitch Linux Server: Fail2ban Linux Workstation: etckeeper Windows Workstation: GlassWire Windows Server: Sysmon — What are yours?”

Full thread at [Wayback/Archive] Thread by @cyb3rops on Thread Reader App

Some interesting responses to the original tweet, hence me saving it.

–jeroen

Posted in *nix, *nix-tools, Apple, BSD, FreeBSD, Mac OS X / OS X / MacOS, Power User, Windows | Leave a Comment »

GitHub – walles/moar: Moar is a pager. It’s designed to just do the right thing without any configuration.

Posted by jpluimers on 2025/05/08

Having used less for 40+ years now, I wonder how moar measures up to it: [Wayback/Archive] GitHub – walles/moar: Moar is a pager. It’s designed to just do the right thing without any configuration.

Features I at least expect are in [Wayback/Archive] less: display the contents of a file in a terminal | less Commands | Man Pages | ManKier.

Via [Wayback/Archive] Johan Walles recently commenting on [Wayback/Archive] linux – How can I have less automatically decompress xz files like it did with gz files on my old SUSE distro? – Super User.

--jeroen

Posted in *nix, *nix-tools, Apple, BSD, Development, Go (golang), Mac, Mac OS X / OS X / MacOS, Power User, Software Development | Leave a Comment »

Some SQLite things I recently learned a while ago

Posted by jpluimers on 2025/04/30

More on the reason why I learned a few SQLite things soon, but for my link and documentation archive, below is what I learned.

Most commands use the database file C:\temp\History which has no extension as that is how I got the file in the first place (spoiler: it’s a Chrome browser History from one of my user profiles).

Let’s get started:

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, CommandLine, Conference Topics, Conferences, Console (command prompt window), Database Development, Development, Event, Power User, PowerShell, PowerShell, Software Development, SQL, SQLite | Leave a Comment »

“NAMED_CONF_INCLUDE_FILES” has been gone from /etc/sysconfig/named since OpenSuSE 15.4

Posted by jpluimers on 2025/04/28

In the past, I used to modify /etc/sysconfig/named and add entries to the NAMED_CONF_INCLUDE_FILES setting, then run /usr/share/bind/createNamedConfInclude
to generate /etc/named.conf.include.

As of OpenSuSE 15.4, /usr/share/bind/createNamedConfInclude has become an empty file and NAMED_CONF_INCLUDE_FILES got removed and NAMED_INITIALIZE_SCRIPTS introduced.

So now I changed my playbooks to manually generate /etc/named.conf.include and include it form /etc/sysconfig/named.

Since I hardly perform these new installations, it took a few years for me to find out about this change. Upgrading existing systems somehow kept the generated file and included it.

Related links with quotes as it was hard to find out what changed and how to work around and I wasn’t the only one bump into issues:

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, bash, bind-named, Development, DNS, LEAP, Linux, openSuSE, Power User, Scripting, Software Development, SuSE Linux | Tagged: | Leave a Comment »

Parallel hashing on MacOS

Posted by jpluimers on 2025/04/14

Now that I have had an Apple silicon for a while, which has enough cores to perform parallel work, this is how I calculated a bunch of hashed from a lot of large files:

  • find . -type f | xargs -P 0 -n 1 md5 -r
  • find . -type f | xargs -P 0 -n 1 shasum --algorithm 1
  • find . -type f | xargs -P 0 -n 1 shasum --algorithm 256

I contemplated about using GNU parallel, but that is not installed by default on MacOS and I was already familiar with xargs.

Argument meanings can be found at these locations:

Related:

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, Apple Silicon, ARM Mac, M1 Mac, Mac, Mac OS X / OS X / MacOS, Power User, xargs | Leave a Comment »