Random knowledge XVI.

Mar 17, 2016

In this modern age of viruses, worms, and script kiddies, there are manufacturers who will, in fact, pitch a fit if you try to install a security patch of any kind. There are also network-accessible appliances out there that require the use of telnet and eschew SSH for secure administrative connections.

It's a good idea to assign values to variables as close to where they'll be used as possible so that you don't lose track of what they are called or what they're supposed to do.

Write the simplest regular expression that'll do the job that you can, so you'll spend far, far less time debugging later.

Whenever you go back to the office after a day of being off-site for any reason (be it working from home or a day off) and one of your cow-orkers tells you that everything went smoothly that day, you may as well put on a pot of coffee because the shit's going to hit the fan.

If there is any chance at all that one of your co-workers will do something to prevent you from leaving work early, they'll do it.

When grepping logfiles for a certain string, it is often advantageous to do two things: Prevent grep from displaying the filename for every matching line found, and separate each line with a blank line to make them easier to read. This can be done in this way:

grep -h 'foo' /path/to/logfiles | sed 's/$/\n/' | less

The -h option to grep suppresses the printing of the filename before each matching line. The invocation of sed (stream editor) substitutes a newline character (\n) for the end of each line printed by grep.

For every post you make to a Securityfocus mailing list, you'll get between five and seventy error messages from people who signed up to the same list with a fake address, are on vacation, or who haven't swept out their inboxes in months (and are consequently out of space).

Polycom phones are a great excuse to buy a bunch of UPSes, because they take upwards of five minutes each to boot back up. A one minute power outage can easily lead to an hour of downtime as each Polycom phone in the facility boots up, and probably errors out a couple of times.

In an environment with redundant servers, always make sure you're on the correct server before doing any lookups or making any alterations.

Let's say that you're sent offsite for work for whatever reason. The job takes all day, and you wrap everything up around quitting time. However, earlier that day you left something fairly important at work, so rather than go straight home, you go back to work to pick up $FOO and then head home.

It will be 90% certain that you'll be shanghai'd at work for at least another hour doing something. If you have something important lined up for after work, it will be 100% certain that you'll be stuck there for at least another hour.

Have one of your co-workers pick up $FOO and bring it to you after work. Don't risk it.

When making a pizza yourself, be sure to put the peppers, onions, and mushrooms as close to the top of the pizza's surface as possible so that they will cook through first. These toppings have a lot of water in them that you want to evaporate. If you bury them under the other toppings the water won't evaporate, and the pizza crust will flood.