Revolving at 900 miles an hour

Disks: MBR, GUID, Basic, Dynamic

Managing disks in Windows isn’t that complicated, but there are some useful things you should know that can help you make smart decisions in allocating disk storage. Besides, you can never tell when this stuff might come up in a rousing game of Trivial Pursuit, MCSE Edition.

Continue reading

An untitled poem by Heinrich Heine


The night is quiet, the streets are calm,
In this house my beloved once lived:
She has long since left the town,
But the house still stands, here in the same place.

A man stands there also and looks to the sky,
And wrings his hands, overwhelmed by pain:
I am terrified — when I see his face,
The moon shows me my own form!

O you Doppelgänger! you pale comrade!
Why do you ape the pain of my love
Which tormented me upon this spot
So many a night, so long ago?

—Heinrich Heine, Buch der Lieder

Be seeing you.

Those were (not) the days

The cal command’s little secret

In my Linux and Unix classes I introduce the students to a nifty little CLI tool called cal. Run from the command line, it displays a calendar of the current month with today highlighted. If you have a *nix terminal handy, fire it up and let’s take this little baby for a test drive.

Run cal and you get the calendar for the current month. To see the calendar for the entire year, run cal 2018.

You can also ask cal for a specific month and year. To find the date for Thanksgiving in the year 2023, run cal 11 2023. Pass cal the month and year of your birth and you’ll see what day of the week was graced by that momentous occasion.

But do you want to see something cool? Run cal 9 1752. You might notice something wrong here—September of 1752 is missing eleven days! Is cal broken? Hardly. In September of 1752 the British Empire (finally) adopted the Gregorian calendar to correct an error that was, by that time, eleven days long. What’s cool is that a little Unix program already knew all that, so you don’t have to worry about accidentally scheduling a Tardis trip for London, September 8, 1752. That is, assuming the Tardis runs a version of Unix…

So, there’s some trivia for the local pub. Perhaps you can use it to win a few drinks. And watch out for blue police call boxes.

Be seeing you.

Praise the Lord and pass the arguments!

How to use xargs

One interesting utility in Unix is the little xargs command. It takes something from standard input and passes it as an argument to another command. For example, if a command expects a user name, you can get that name from somewhere and feed it to the command through xargs:

whoami | xargs passwd

The silly example above is also superfluous—passwd can accept a user name through standard input directly, so xargs isn’t needed here. And of course, passwd with no arguments would change the current user’s password anyway. But this is a simple way to illustrate what xargs does. Some commands don’t look for a required argument in the standard input stream, so they won’t read directly from the pipe. xargs takes whatever is in the pipe and sends it as an argument to the command that follows; in this case, passwd.

I personally use xargs in my .xinitrc file to set a random background wallpaper on my desktop when I start X:

find ~/pictures/wallpapers -type f | sort -R | tail -1 | xargs feh --bg-fill

The find command locates all the files in my wallpapers directory. The sort command puts the file names in random order and the tail command grabs only the last one in the list. xargs then passes that to feh, an image display utility, which sets the randomly selected file as my wallpaper. And so X greets me with a surprise every time I go GUI.

Be seeing you.

Let x = a whole bunch of things

Set multiple variables at once in PowerShell

A list of variable names can be an l-value, that is, an expression that appears on the left side of an assignment operator. Did you know that you can do this…

PS C:\> $FirstName, $Initial, $LastName = 'John', 'Q', 'Public'

This statement will assign to each variable the corresponding value on the right of the assignment operator. What if the number of variable names and the number of values doesn’t match? Extra values will be stored as an array in the last variable.

PS C:\> $FirstName, $Initial, $LastName = 'John', 'Q', 'Public', 'Sr', 'Esq'

That $LastName variable will be a list containing Public, Sr, and Esq. If there aren’t enough values to go around, the extra variables are unassigned.

Oh, and if you want to set several variable names to the same value, use this:

PS C:\> $a = $b = $c = $d = 90

Have fun with your variables.

Be seeing you.

So many files, so little time

Editing multiple documents in vim: Using vim buffers

When editing a file in vim it is stored and displayed in a buffer, something like a tab in a web browser window. You can open multiple files at once and easily move back and forth among the buffers to work with each file.

Opening multiple files in vim

To open multiple files in vim when you start your session, simply list them on the command line:
$ vim myfile1 myfile2 myfile3 myfile4
This will start vim with four buffers pre-loaded with your four files. You can use wildcards:
$ vim documents/myfile*

If you already have vim running and want to open another file, go to command mode and type:
:e documents/myfile5

You’ll be happy to know that you can use tab completion with the :e command. If you want to create a new file within vim, from command mode run :enew which will open an empty buffer. Just remember to save the file with a name anytime before you exit:
:sav documents/myfile6

To see the buffers open in your current session, from command mode run :buffers. Note that each buffer lists the file that it contains, and each has a unique number. To move to a different buffer, run :b# where the # sign represents the buffer number you want to move to. For example, to begin editing the file in buffer number 3, run:

Keep in mind that before you can switch to a new buffer you must save or discard all the changes made to the current one. Use the :w command to save your file before changing buffers.

You can cut, copy and paste among buffers just as you would within a single file. Just remember that if you make a cut you will need to save the changes in the current file before switching to the target buffer.

When you no longer want to work on a file you can close its buffer with the “buffer delete” command, :bd. This command closes the file in the current buffer and deletes the buffer; the file is not removed. By adding a number you can delete a specific buffer. For example:
This will close the file in buffer 3 and delete the buffer. And quitting vim will close all files and delete all buffers.

Be seeing you.

“You keep using that word. I don’t think that word means what you think it means.”

Random vs. urandom

I’ve been told for most of my professional life that /dev/random was “better” than /dev/urandom, that one was inherently more secure and sophisticated than the other. I bought it, because it made sense based upon the little I know about cryptography. And there’s the rub. Most of us aren’t experts in the field. This cool little article delves into some good explanations of what is meant by “random” and why it matters. It may turn some of your preciously-held notions upside down, but that’s okay. The day we stop learning is the day we start dying.

Be seeing you!

Old Tales


So we’ll live,
And pray, and sing, and tell old tales, and laugh
At gilded butterflies, and hear poor rogues
Talk of court news; and we’ll talk with them too,
Who loses and who wins; who’s in, who’s out; —
And take upon’s the mystery of things,
As if we were God’s spies.

King Lear, Scene III

Be seeing you.

I’m just an ordinary average guy.

Load Average: those funny little numbers

I was going to write a little article on interpreting the load average in Unix and Linux machines, but I ran across this blog post and don’t think I could have said it better. Really, check it out.

When I’m logged into a graphical session on my FreeBSD system I use conky to monitor hardware utilization and performance (and the local weather and unread messages in my GMail inbox, etc.) But normally I work from the command line with ssh and tmux, so I have created an alias that I load in my login profile to let me get at the load average in a quick and easy fashion:

alias loads='sysctl vm.loadavg | cut -d" " -f3,4,5'

Now I just run loads any time I want to see how my cpu cores are doing.

Be seeing you.

“Books, young man, books.”

Free books for your company’s computer guy

Free is good. Books are good. Just ask Samuel T. Cogley.

So, how about free books?

Are you a Windows admin? Read free eBooks from Microsoft Press.

Do you run Linux boxes? Get a free eBook from The Geek Stuff.

And keep checking in here. I don’t have any plans for a novel anytime soon, but I will share with you some helpful tidbits in working with Linux, PowerShell, Windows, Python, and other things that interest me.

Be seeing you.