Drop #438 (2024-04-04): Snow Day Shellmageddon

has; w3m; tmpmail

We’re in the midst of (hopefully) our last snowstorm of the season, and it sure is a blizzard out there. Comcast is out and Verizon is struggling to keep up with the mobile internet demand of a few thousand humans stuck at home in my tiny part of rural Maine. So, we’re going to spend some time at a shell prompt today, since multi-megabyte page downloads just aren’t happening.

Once I have stable and fast(er) internet I’ll upload section header images.

No TL;DR as the sections are short enough w/o it.

has

The has utility is a cross-platform shell script that checks for the presence of command line tools and other software. It’s a great way to check if you have a tool installed and if not, install it.

I have this as an alias, so I can quickly double-check the versions of all the things I may use on any given system (php is for WordPress):

$ has bat bun clang curl deno \
      duckdb fd gcc go java jq \
      just make node php python3 \
      rg ruby rust swift vim R
✓ bat 0.24.0
✓ bun 1.0.27
✓ clang 15.0.0
✓ curl 8.4.0
✓ deno 1.39.4
✓ duckdb 0.10.1
✓ fd 9.0.0
✓ gcc 15.0.0
✓ go 1.22.1
✓ java 11.0.10
✓ jq 1.7.1
✓ just 1.25.2
✓ make 3.81
✓ node 21.7.1
✗ php
✓ python3 3.12.2
✓ rg 14.1.0
✓ ruby 2.6.10
✓ rustc 1.71.0
✓ swift 1.90.11.
✓ vim 9.0
✓ R 4.3.3

NOTE: Please do not follow their guidance to run it from the internet via curl|bash.

The real use of it is to simplify testing if a command is present in a shell script:

$ if has -q bun ; then sudo make me_a_hamburger ; fi

It does one thing, and does it well. Plus, there are some good Bash coding practices to follow in the script itself.

w3m

It’s text-only mode for me for a while today, which made me realize we haven’t covered w3m before.

It’s a local CLI pager (i.e., morelessbat substitute) that can render HTML (sans javascript) to the console or let you browse the internets.

NOTE: macOS folk can brew install w3m

You will likely need to peruse the manual to avoid some frustration. But, after doing so, hit up CNN lite mode with:

$ w3m https://lite.cnn.com/

You can find more text-only/lightweight news sites here.

And, see how fairly usable this newsletter is with it:

$ w3m https://dailydrop.hrbrmstr.dev/

Make sure to w3m -h to see what extra crunchy things you can do with it.

tmpmail

The number of sites that ask for my email just so I can view a precious PDF (or get other basic information) seems to double every year. Most of the time I’ll never need to correspond with those places again, so a “temporary” email address works just fine.

Many of the temporary email sites are pretty sketch, and most of the web interfaces leave much to be desired. That’s where tmpmail comes in. It’s an sh script that works with 1secmail’s “API” to generate an email that can be used immediately.

Here’s an example where I generate an address:

$ tmpmail --generate
cwqfeftqyku@1secmail.net

Then use my real mail client to send that a message.

I then check the inbox:

$ tmpmail
[ Inbox for cwqfeftqyku@1secmail.net ]

1324476431   bob@rud.is   'sup Daily Drop readers!

and can also read the mail.

$ tmpmail --recent
To: cwqfeftqyku@1secmail.net
From: bob@rud.is
Subject: 'sup Daily Drop readers!

This would normally be spam.

Do NOT use this service for anything that may drop sensitive/personal information, as you can peruse any email address that’s currently in-use (provided you can iterate over the generated addresses quickly enough).

Give it a go the next time you need to give some vendor your addy for a PDF and see how it goes.

FIN

Remember, you can follow and interact with the full text of The Daily Drop’s free posts on Mastodon via @dailydrop.hrbrmstr.dev@dailydrop.hrbrmstr.dev ☮️

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.