menga
home - books - search - contact
Read my book: Don't Run A Web Site

how to encrypt and decrypt a tar, one-liner version

Thu 2025 Apr 3

I do love one-liners that I can do on the command line in Linux, and this one has to do with TAR archives.

TAR, on its own, doesn't encrypt anything. This being true, a separate utility has to be used to encrypt it. The easiest one is GPG.

GPG is GNU Privacy Guard, and should already be installed on your Linux system. You can check this with which gpg. If you get a result of something like /usr/bin/gpg, it's already installed. If you get a blank result back, then you need to install it. Installing GPG should readily be in the main repository for your Linux distribution.

Let's say I have a folder called my-folder on the Desktop where I want to put all the files in that folder into a TAR and encrypt it with a password. I launch a Terminal and do this first:

cd ~/Desktop

After that, this:

tar -cvf - my-folder | gpg -c --batch --passphrase mypassword > my-folder.tar.gpg

The above will create the compressed archive my-folder.tar.gpg, and encrypt it using the password mypassword.

If you DO NOT want the archive compressed (which results in faster creation but a larger archive), --compress-algo none needs to be added in, like this:

tar -cvf - my-folder | gpg -c --compress-algo none --batch --passphrase mypassword > my-folder.tar.gpg

Obviously, change mypassword to a password of your choice.

To decrypt and extract the archive, put my-folder.tar.gpg on the Desktop and run this:

cd ~/Desktop;mkdir extract;cat my-folder.tar.gpg | gpg -d --batch --passphrase mypassword | tar -C extract -xvf -

A folder called extract will be created on the Desktop, and the contents of my-folder.tar.gpg will be decrypted and extracted to that folder.

Doing the same thing but with progress bars

When creating/encrypting, change -cvf to -cf and add --checkpoint=.1000 like this:

tar --checkpoint=.1000 -cf - my-folder | gpg -c --batch --passphrase mypassword > my-folder.tar.gpg

The result of this is that while the archive is being created, dots (as in periods) will show indicating progress until completed.

For extraction, pv will need to be installed, which means pipe viewer. This utility should be available in the main repository for your Linux distribution.

Change cat to pv and -xvf to -xf, like this:

cd ~/Desktop;mkdir extract;pv my-folder.tar.gpg | gpg -d --batch --passphrase mypassword | tar -C extract -xf -

During extraction, you'll see the progress bar.

permalink

don't use distilled water in a coffee maker

Tue 2025 Apr 1

I learned this one the hard way, but fortunately I didn't wreck my coffee maker.

One would think that using distilled water would be better than tap for brewing coffee, right? That's what I thought. I was wrong.

While I do grind my own coffee beans, I'm not exactly what you'd call a coffee snob since I just buy the cheap whole bean stuff. I'm mentioning this for a reason. A few weeks back, I was in the supermarket and noticed some mid-grade coffee had been discounted. It was cheaper than what I regularly buy, so I said okay, I'll try this stuff.

After getting it back to the house, I ground some of the beans and brewed a cup. It did not taste that good, so I threw it out. At the time, I had a jug of distilled water, so I said screw it, let's try brewing this with the distilled and made another cup. The coffee then tasted better. Not great, but better. Then I said to myself okay, this coffee has been bought, I have some distilled water, and I'll just make coffee this way until I run out.

Not smart.

Here are the three reasons why distilled water is bad for brewing coffee with:

Distilled water is by its very nature tasteless. This is fine for cooking, bathing and of course drinking straight, but not-so much for brewing. Water with some mineral content in it does make for better tasting coffee. Some coffee snobs call that mineral content "notes" in the flavor. Take out the minerals and those notes are gone.

Distilled water can literally mess up the coffee brewing process. When using distilled water, this can cause coffee grounds to swell more, which in turn slows the water flow. What's the result of that? Bitterness from the water not getting through the grounds fast enough.

Distilled water can actually damage a coffee maker. When the water doesn't get through fast enough, the coffee maker works harder to brew. If that happens enough times, you end up with a dead coffee maker.

So what's the best kind of water for brewing coffee with?

Tap or filtered tap. And I suppose water labeled as "spring water" counts too as that has mineral content in it.

Ultra coffee snobs and professional coffee people condition the water used to a very specific ppm (parts-per-million) for "optimum" balance of minerals that brings out the best flavor...

...and I am absolutely not going to do that. All I know is "distilled bad, mineral good" for brewing coffee.

What I learned is that the fact that mid-tier coffee I acquired tasted slightly better using distilled water means it was bad coffee out of the gate. Decent coffee will taste correct with tap or filtered tap water. If it doesn't, that either means you just don't like it, or the coffee is outright bad. And that may be exactly what happened in my situation. That coffee must have been on sale for a reason.

I'm back to my old whole bean coffee and using tap water to brew with. Every coffee maker agrees with it, and the end result is that the coffee tastes good, just how I like it. I won't be swayed by on-sale stuff again, and just stick with what I know works.

permalink

i'm glad arcade machines are somebody else's problem

Thu 2025 Mar 27

One time in my life I had an arcade machine in the house. It was a video arcade game, Mortal Kombat 3. I think I had it for a year or maybe slightly longer, then sold it. I've no regrets about that whatsoever.

Once or twice a year I'll go play some arcade machines. I enjoy the games, but I am VERY glad I don't have to maintain these things.

Back in the '80s when I was a little kid, there was a television show, Silver Spoons. A large chunk of that show took place in the main living room of a house. In the background on that set were a few arcade machines. Some were video, some pinball. I saw that, and thought wow, how COOL would it be to have arcade machines right there in the living room.

Well, I actually found out. Sort of.

I had that MK3 machine as I mentioned before, but I also saw games in other people's places too over the years.

In the '90s while attending college, I went with a friend to visit his friend that lived in an off-campus apartment, and in there was a Centipede machine. I thought hey, that's cool, but wow, that's really taking up some space. If I remember correctly, the guy who owned it even complained he couldn't run it too long because it would literally heat up the apartment too much.

I'd also periodically visit places (usually a friend-of-a-friend's home), and there would either be a room or a finished basement with a pool table there. That's not a pinball nor video game machine, but it's still something usually only seen in bars and arcades. Any time I saw one of these in a house, it was always unused. There would either be a cover over it, or if uncovered, there was always dust accumulated.

At this point I have zero desire to actually own an arcade machine, and it's not just because I briefly owned one before.

There are two realities when it comes to arcade machines, pool tables and other games like that.

The first reality is that the games were never built to last and specifically designed to be rented. A company would stock the games, rent them out to businesses for a few months to a year (usually with a service contract so a tech can be called in to fix a machine when it breaks), and that's the way it worked.

If you bring one of those games in your home, you have no service tech dude you can call for when the machine breaks. You are the tech. No thanks.

The second reality is that the games were made to be used in public spaces with people in them.

Something I found out with my own MK3 machine is that when you're playing an arcade game alone in the house, it sucks. You get this depressing feeling of emptiness. And yes, that was one of the reasons I sold the machine.

If you've ever been anywhere with arcade machines and the place is totally empty, then you know the depressing feeling I'm talking about.

For example, a few years back I was in an airport. As I was walking through the terminal, I saw a room with 5 or 6 arcade machines. Nobody was in there and I had free reign to all the games. I thought cool, I'll go play for a little bit. That lasted for maybe 5 minutes, because I felt that same depressing empty feeling kick in. I walked away from the machine I was using while still in play, thinking yep, this is no fun. I'm out.

Dedicating space in your home for an arcade machine and/or a pool table is a bad idea. The game won't get used, it will collect dust, it will fall into disrepair. All of that will happen.

Whenever I feel the need to play pinball or a video arcade game, that's something I go out to do. In the home, the only "arcade" machine I have is a Ms. Pac-Man mini. I find this far easier to deal with compared to a full size video arcade machine. The full-size stuff is somebody else's problem, and that's fine by me. I just play the machine and have no interest in putting that big thing in my house nor fixing it when it breaks.

And yes, they still make these if you want one. Fun thing to have, and takes up very little space. Very nice.

permalink

how to get a super short physical address

Tue 2025 Mar 25

Navigation is wrong, and often. This is how to make it right, and also make it very easy to store locations for retrieval later.

Common navigation problem: You can't trust a physical address

It used to be that once a physical address was established, it was very rare that it would change. Whether the address was for somewhere residential (ex: a house) or commercial (ex: a business, government building or whatever), you used to be able to punch in an address and your navigation system be it Garmin DriveSmart (I use the 76 model), phone app or infotainment would get you to the right place.

These days, when you punch in an address, the nav system either a) won't find it, or b) find it, but direct you somewhere that's on the wrong side of the street and/or wrong parking area.

Two examples of this are mall stores and apartment complexes. In a mall, when trying to get to a specific storefront, you don't want 1234 Main St, but rather 1234 Main St Suite #567. In an apartment complex, you don't want 1234 Main St but rather 1234 Main St Apt. 567 - or - 1234 Main St Apts 500-600 so you can at least arrive at the correct building to find the apartment you're looking for.

Common navigation problem: Your favorites a.k.a. saved locations or travel history disappears

To note, this doesn't happen on a Garmin, ever. This is mostly a phone nav app problem.

On a phone nav app, it used to be that you could easily go back through your travel history to find places you've been before. You could also save locations easily.

These days, you truly have no idea if your travel history or saved locations will be there tomorrow. One little glitch is all is takes, and that valuable info is GONE with absolutely no way to get it back.

Solution: Short form GPS coordinates

This is how short it can get:

N28.0542 W82.4049
or
28.0542,-82.4049

If you copy/paste either of those into a map web site, you will see it takes you to the Museum of Science and Industry in Tampa Florida.

Any location can be shrunk down to 12 or 13 digits.

Here's an example of a 13-digit:

N33.8126 W117.9273
or
33.8126,-117.9273

That's the location of the entrance sign to the Disneyland Hotel in Anaheim California. And again, you can punch those coordinates in and be taken directly to that spot.

What's the point of using these?

These are short enough to easily send in a text message, write down on a little piece of paper you can keep in your car, or remember it in your head outright.

How to get the coordinates? Right-click on the spot you want to save using Google Maps or Bing Maps, then round up the numbers.

Looking at that Anaheim location again, the actual long form of that is this:

33.81260308822693,-117.9273000751936

This is ridiculously long and you'd never remember it. But you can remember 33.8126,-117.9273 or send that to yourself as a text message or write it down.

The best part: Coordinates do not change

Street name changes? Doesn't matter. Business name changes? Doesn't matter. Building changes? Doesn't matter. Roads around the building changes? Doesn't matter.

Your super short 12 or 13-digit set of coordinates will always take you to the right spot, every time.

Is a coordinate set an address you can mail something to? Technically, no, but in practice with whatever nav system you have, yes. Consider it a "good-for-humans address". Short, easy to remember, easy to store.

When addresses fail - and they do - use coordinates instead. They always work.

permalink

when 512GB is actually 476

Thu 2025 Mar 20

To this day I see negative Amazon reviews from people who bought computer media storage and believe they got scammed - except they didn't.

One of the more common ones are people who buy a 512GB flash drive, plug it in to their computer or phone, see a total storage limit of 476, and immediately think they got ripped off. Wrong. The number is accurate.

The confusion exists because an operating system reports the total available space in binary, but most (all?) computer media products for sale state the available space in metric.

It's standard practice to list total storage using metric on packaging and binary within operating systems.

When in Windows, if I examine the properties of my Samsung 512 GB EVO SD memory card when attached, "Capacity:" states 476GB. You'd see that 476 GB and think you got ripped off. Nope. Directly to the left of that 476GB, the total bytes are shown, which is 512,057,409,536 bytes total. In GB, that's 512. In GiB, it's 476, or to be technical, 476.890625 GiB. That's actually supposed to round up to 477 GiB, but 476 is stated. Whatever.

In Linux, same thing, I see the 476 GiB.

The way to get the exact output in terminal for total GiB capacity for Linux is this:

lsblk --output SIZE -n -d /dev/sdX

Want it in bytes? Add a -b:

lsblk -b --output SIZE -n -d /dev/sdX

The "sdX" part is whatever path your drive is assigned to.

permalink

« older posts  newer posts »