Dig

I’m putting this here for my own sanity.

An extremely powerful command line tool is dig, unless you forget how to use it.

Here is a simple bash function that can be added to .bashrc so you don’t need to remember how to use it.

Usage: digit google.com

Output:

:~$ digit google.com
google.com.		101 IN MX 50 alt4.aspmx.l.google.com.
google.com.		101 IN MX 10 aspmx.l.google.com.
google.com.		101 IN MX 20 alt1.aspmx.l.google.com.
google.com.		101 IN MX 30 alt2.aspmx.l.google.com.
google.com.		101 IN MX 40 alt3.aspmx.l.google.com.
google.com.		1339 IN	TXT "v=spf1 include:_spf.google.com ip4:216.73.93.70/31 ip4:216.73.93.72/31 ~all"
google.com.		80 IN A	74.125.30.100
google.com.		80 IN A	74.125.30.101
google.com.		80 IN A	74.125.30.102
google.com.		80 IN A	74.125.30.113
google.com.		80 IN A	74.125.30.138
google.com.		80 IN A	74.125.30.139
google.com.		244 IN AAAA 2607:f8b0:4003:c03::66
google.com.		91454 IN NS ns4.google.com.
google.com.		91454 IN NS ns3.google.com.
google.com.		91454 IN NS ns2.google.com.
google.com.		91454 IN NS ns1.google.com.
# digit function
digit() {
	dig +nocmd $1 any +multiline +noall +answer
}

IMT Trailer Install

I had a pretty cool project come up.  It was for a county wide incident management team trailer.  Its intended use is for storage, some work area, and some technology.

I knew I had minimum space so I wanted to do a sliding rack.  I started with an old generator drawer from a fire engine, and yes it was loaded with carbon.  After I sprayed it down with an awesome chemical cocktail (I’m kidding, I used PB Blaster) it cleaned up, sort of.

The pictures explain everything else but if you hate pictures here is the text version.

  • Build wood frame for drawer and bolt it
  • Build wood top for rack and bolt it
  • Bolt that to floor, design pin system for drawer so it doesn’t slide out (I used 1/8″ x 2″ steel “C” channel, stainless bolts through the floor)
  • Build out frame for tv mount and mount the tv
  • Route cables from TV and Rack into I/O Bay (no picture, forgot)
  • Bolt in rack and add equipment
  • Take pictures (including one of my kids assessment of the project)

 

Building a server rack

I had some extra rackmount drawers from Middle Atlantic and I figured I would put them to good use by building a small server rack.  For the location I had planned I had 26 1/4″ from the floor to under a countertop available.  So a set of Middle Atlantic RRF14 would do just right.  I used 3/4 oak plywood for the rest of the structure.  My dimensions for the inside of the rack would be 24 1/2″ tall x 22 deep x 19 1/8 wide.  I didn’t need it to be 22″ deep because the drawers I used only have about a 15″ depth but I wanted the 7 extra inches for anything else I might put in.

I love pocket holes.  It might have to do with my lack of skills in other types of joinery but I don’t care.

 

For the face I used some 1×4″ solid red oak and ripped off a 3/4″ strip.

Yes, I burned it, that’s what sandpaper is for.

There are many good places to explain nominal wood thickness, this is not one of them.  For the sake of explaining anything beyond my comprehension I’ll keep it simple… 1x isn’t 1″ thick (I hope you know that) and 3/4″ plywood isn’t 3/4″, it’s 23/32.  All makes sense?  Excellent.  Since the math never works in my favor, I use a flush router bit to make it even.  I then followed it up with a small round over bit.

Here we go, installed.

 

 

*PS – I’m not sorry for the huge photos.

iPhone makes me upset.

I will admit, Apple makes things easy.  I recently experienced the opposite…

I created a business card with a QR code that linked to a website to download a vcard.   Sadly, Safari doesn’t know what to do when you tell it to download a .vcf file. Android 1, iOS 0.  If you make the same mistake I did, don’t fret, people have made it easy.  I’ve made it even easier.

Follow my steps.

If you’re using a nginx server, and you should be, add a rewrite rule.

location /yourcard.vcf {
 if ($http_user_agent ~* '(iPhone|iPad)') {
  rewrite     ^(.*) http://domain.com/yourcard.php permanent;
 }
}

You should notice anyone visiting /yourcard.vcf will be redirected to yourcard.php.  So let’s make a yourcard.php.

<?php

if (isset($_POST["email"])) {

$useremail = $_POST["email"];

$content = "BEGIN:VCARD\r\n";
$content .= "VERSION:2.1\r\n";
$content .= "N:Doe;John;M;;\r\n";
$content .= "FN:John Doe\r\n";
$content .= "ORG:My Work;My Job\r\n";
$content .= "TEL;CELL;VOICE:0000000000\r\n";
$content .= "URL;WORK:http://domain.com\r\n";
$content .= "EMAIL;PREF;INTERNET:jdoe@domain.com\r\n";
$content .= "REV:20120920T23:43:27Z\r\n";
$content .= "END:VCARD\r\n";

$sendermail = "jdoe@domain.com";

function mail_attachment($filename, $content, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $fileatt_type = "text/x-vcard";

    $headers = "FROM: ".$from_mail;

    $data = $content;

    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

    $headers .= "\nMIME-Version: 1.0\n" .
    "Content-Type: multipart/mixed;\n" .
    " boundary=\"{$mime_boundary}\"";

    $message = "This is a multi-part message in MIME format.\n\n" .
    "--{$mime_boundary}\n" .
    "Content-Type:text/html; charset=\"iso-8859-1\"\n" .
    "Content-Transfer-Encoding: 7bit\n\n" .
    $message . "\n\n";
    $message .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt_type};\n" .
    " name=\"{$filename}\"\n" .
    "Content-Transfer-Encoding: 8bit\n" .
    "Content-Disposition: attachment;\n" .
    " filename=\"{$filename}\"\n\n" .
    $data . "\n\n" .
    "--{$mime_boundary}--\n";
    mail($mailto, $subject, $message, $headers);
}

mail_attachment("My_Card.vcf", $content, $useremail, $sendermail, "John Doe", $sendermail, "John Doe's Contact Information", "Please find my information that is attached in vcard format.  Thanks!");
?>
My contact information was sent, please check your inbox.
<?php
} else {
?>
<form action="yourcard.php" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="bodytext">Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext"> </td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
<?php
};
?>

All done.