vi paste contents of another file in current file

June 18th, 2019

While editing a file in vi, in order to paste the contents of another file at the current location type:

:r filename_to_paste

 

Perl file open details

June 18th, 2019

There are several ways to open files in Perl and it seems that there are many opinions on the best way to do so. I've looked into it a bit and I believe that I'm going to use the three-argument version of open going forward.

open (my $filename_fh, '<', $filename);

As stated in the linked page, benefits include:

  • Perl will open files even if they contain file operation (< > |) characters
  • The scalar file handle ends in _fh so it should be obvious it is a file handle everywhere
  • The file handle should be meaningful
  • The file handle will be cleaned up automatically if it goes out of scope

Accessing Plex media from Sonos

June 18th, 2019

Since I got my first Sonos device, I wanted to be able to play music from my Plex server. Unfortunately, due to the way Sonos issues the network requests, it didn't work properly. I use pfSense for my router and tried a number of workarounds but the one that finally worked was this one:

In the pfSense Plex NAT firewall rule (pfSense->Firewall->NAT->Port Forward->Edit) change the NAT reflection setting to "Enable (NAT + Proxy).

Home Depot DIY Garage Shelves

April 3rd, 2019

DIY Garage Shelves

Jump to Specific Step

1
Gather Tools and Materials

gather the tools and materials

Before you begin, gather the following tools and materials:

2
Mark the Locations of the Top Plates on the Ceiling

Illustration of a man drilling top plates into the ceiling.

  • One plate should be flush against the wall and the other should be parallel to it with its front edge 24 inches from the wall.
  • Cut the 2- x 4-inch top plates to the full length of the shelves, then attach to the ceiling joists using 3-inch screws.
3
Mark Points Directly Beneath The Outside Corners

Illustration of a man using a plumb bob to measure and mark the floor.

  • Using a plumb bob as a guide, mark the points directly beneath the outside corners of the top plates to find the outer sole plate locations. 
  • Mark the sole plate locations by drawing lines perpendicular to the wall, connecting each pair of points.
4
Cut Outer 2- x 4-inch Sole Plates

Illustration of someone drilling into wooden sole plate beams.

  • Measure and cut the sole plates to their desired lengths and align on top of the lines you just drew.
  • Drill the sole plates into the ground for additional support.

Tip: Learn how to drill into concrete with this handy guide.

5
Prepare The Shelf Risers

Illustration of someone cutting lumber into shelving risers.

  • Prepare the shelf risers by cutting 7/8-inch wide dado grooves with a router. Cut dadoes every 4 inches along the inside face of each 2- x 4-inch riser with the top and bottom dadoes about 12 inches from the ends. 
  • Gang-cut the risers by laying them flat, clamping them together and attaching a straightedge guide to align your dado cuts. 
  • For each cut, make several passes with the router, gradually extending the bit depth until the dadoes are ¾-inch deep.
6
Trim The Shelf Risers

Illustration of someone trimming shelf risers using a circular saw.

  • Using a circular saw and a straightedge guide, trim the shelf risers to a uniform length before unclamping them.
7
Build Two Center and Four End Shelf Supports

build the four end shelf supports

  • Build two center supports by positioning pairs of shelf risers back-to-back.
  • Joining them with wood glue and 2 ½-inch screws.
  • Build four end shelf supports by positioning the back of the dadoes shelf riser against a 2 -x 4-inch board of the same length.
  • Join them with glue and 2 ½-inch screws.
8
Position End Shelf Supports

Illustration of someone drilling end shelves into sole plates.

  • Position an end shelf support at each corner of the shelving unit between the top and sole plates. 
  • Attach the supports by driving 3-inch screws at an angle into the top plates and sole plates.
9
Position Center Shelf Supports

Illustration of a man drilling center shelf supports into place.

  • Position a center shelf support, one with both faces dadoed, at each end of the center sole plate, then anchor the shelf supports to the sole plate using 3-inch screws driven at an angle. 
  • Use a framing square to align the center shelf supports perpendicular to the top plates. Then, screw them to the top plates.
10
Cut Plywood Shelves to Fit

Illustration of a man slipping shelves into wooden frames.

  • Measure the distance between the facing dado grooves, subtract ¼-inch, and then cut plywood shelves to fit. 
  • Slide the shelves into grooves.

Spam and Virus test strings

August 31st, 2018

When working with mail servers, it is handy to be able to check to ensure your configuration is working as expected.  To that end, here are some test strings that you can use to check it out:

SPAM: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

VIRUS: X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*