Friday Hodgepodge

Friday, December 03, 2021

Four (More or Less Random) Things

1. When you're a parent of young children, there is no such thing as "winning" when it's clock-changing time. First, like everyone else, you lose an hour of sleep when it's time to spring forward. Second, since kids that age are oblivious to such things and don't appreciate opportunities to sleep in, you don't get that extra hour when it's time to fall back.

A few weeks ago, Mrs. Van Horn and I accidentally scored a rare win in that department when we had her folks -- who recently moved nearby -- take the kids for a sleepover so we could have a date night.

I'd completely forgotten about the change, and realized it only the next morning, when I felt unusually well-rested despite being up relatively late. And yes, I did have a small chuckle at my in-laws' expense, because my son wakes as soon as it's light outside.

But Pumpkin is ten and he's eight. By next year, he might also fall back with the rest of us, so this might well have been the last time he would have woken us early. We'll see next year: I'll be careful not to goof up their time change then.

2. This week, I did two things I haven't done in at least a decade: (1) unintentionally deleted a file with hours of work in it; and (2) not had a backup copy of that file elsewhere.

Not wanting to spend a bunch of time re-creating the work and aware that it is prudent to completely overwrite hard drives when getting rid of computers, I cast about for ways to retrieve deleted files on Linux.

GREP -- a standard utility I use every day -- turned out to be up to the task:

[T]he [search] pattern is some string that is known to be in the deleted file. The more specific this string can be, the better. The file being searched ... is the partition of the hard drive the deleted file used to reside in. The "-a" flag tells grep to treat the hard drive partition, which is actually a binary file, as text. Since recovering the entire file would be nice instead of just the lines that are already known, context control is used. The flags "-B 25 -A 100" tell grep to print out 25 lines before a match and 100 lines after a match. Be conservative with estimates on these numbers to ensure the entire file is included (when in doubt, guess bigger numbers). Excess data is easy to trim out of results...
Per a commenter, I saved the results file to a pen drive to avoid looping. I worked on something else for a few hours and then found about ten versions of the lost file among the results. The most-up-to-date was very close to what I had deleted. Whew!

I hope not to have to repeat this neat trick, but for anyone passing by who might need to do this, a refinement: The string -- a URL -- I was able to remember and use for searching was likely also in other files. Fortunately, I could also remember another, non-URL string that was in the file, but which probably would also appear in another set of files. So I ran the GREP search of the hard drive using one string, and looked for the file among those results using the other string: No false positives.

3. En route to other things, I encountered the following compilation of ten funny commercials:

Of the ten, I liked the astronaut commercial and the one for the web-slinging chef the most. I don't watch much television, so I had only seen the commercial featuring the eco-warrior before.

4. Paging Robert Ripley: Here is a rare sighting in the wild of a labor union backing off from harassing someone (It's Item 1, but consider also scrolling down a bit and stopping for ... the warm gooey...):
My fellow baker/staff member was incensed and being the most vocal member of the (union) department, called her rep to complain. The grounds? My "sway" with the staff (I had no sway, they hated me) gave me an unfair advantage, which was the only reason I won [the baking contest]. The union, needing to do due diligence, phoned me for my "side." I had so many real issues to deal with, Bananagate needed to be put to rest quickly, so I told them to just have their baker/member bring in a loaf and then, call me. I heard later that she did provide a loaf to them ... but they never called me again.
That's all, folks!

-- CAV

No comments: