Found this cool site that aggregates HDD and SSD prices from Newegg on a daily basis and lists by price per terabyte: http://edwardbetts.com/price_per_tb/

Unfortunately, it doesn't allow filtering or sorting of the data, so here are some quick and dirty examples.

int_hdd=$(links2 -width 200 -dump http://edwardbetts.com/price_per_tb/internal_hdd/)
ext_hdd=$(links2 -width 200 -dump http://edwardbetts.com/price_per_tb/external_hdd/)
ssd=$(links2 -width 200 -dump http://edwardbetts.com/price_per_tb/ssd/)

Show only 6TB disks:

grep 6TB < <<"$int_hdd"
     $38.33 $229.99     6TB Open Box: WD Green WD60EZRX 6TB 64MB Cache SATA 6.0Gb/s (0 stars)
     $44.00 $263.99     6TB WD Green WD60EZRX 6TB 64MB Cache SATA 6.0Gb/s (4 stars)
     $44.33 $266.00     6TB WD Red WD60EFRX 6TB 64MB Cache SATA 6.0Gb/s 3.5" NAS Hard Drive Bare Drive (4 stars)
     $45.00 $269.99     6TB Seagate STBD6000100 6TB 128MB Cache SATA 6.0Gb/s Retail Kit (4 stars)
     $50.00 $299.99     6TB HGST Deskstar NAS H3IKNAS600012872SN (0S03839) 6TB SATA 6.0Gb/s 3.5" High-Performance Hard Drive for Desktop NAS Systems Retail Kit (4 stars)
     $50.00 $299.99     6TB WD Purple WD60PURX 6TB 64MB Cache SATA 6.0Gb/s 3.5" Surveillance Hard Drive (5 stars)
     $72.67 $435.99     6TB Seagate ST6000NM0024 6TB 128MB Cache SATA 6.0Gb/s 3.5" Enterprise Hard Drive Bare Drive (5 stars)
     $83.33 $499.99     6TB Seagate ST6000NM0054 6TB 128MB Cache SAS 12Gb/s 3.5" SED Enterprise Hard Drive Bare Drive (0 stars)
     $88.33 $529.99     6TB Seagate ST6000NM0104 6TB 128MB Cache SAS 12Gb/s 3.5" SED-FIPS Enterprise Hard Drive Bare Drive (0 stars)
    $121.67 $729.99     6TB HGST He6 HUS726060ALA641(0F20572) 6TB 64MB Cache SATA 6.0Gb/s 3.5" Enterprise Hard Drive (0 stars)

Read the rest of this entry...

For some of my LXC containers, I'm allocating a reserved private IP and need to generate a reasonably unique MAC address that's calculated from the container's hostname. As is LXC's default, I'm using the OUI that belongs to Xensource, Inc (00:16:3e).

Here's a Bash function I'm using:

GetMAC()
{
  if [ -n "$1" ]; then
    OID="00:16:3e"
    RAND=$(echo $1 | md5sum | sed 's/\(..\)\(..\)\(..\).*/\1:\2:\3/')
    echo "$OID:$RAND"
  else
    echo "ERROR: please supply hostname to create MAC address from, e.g.:"
    echo "       $FUNCNAME myhost"
  fi
}

Code in action:

$ GetMAC myhost
00:16:3e:e0:04:92

Useful references:

Remembering the correct openssl syntax for fetching certificate from a remote host or parsing a local certificate file for useful information is a chore, so I finally took my notes and combined into an easy to use shell script.

The script is mostly useful for not having to remember cryptic syntax, but in some cases will also parse and present information in a more readable format than the default openssl output.

It's also easy to add parsing and formatting as needed.

Read the rest of this entry...

Here's an updated version of a previously posted shell script that uses awk to convert a delimited file (where delimiter can be any character) to HTML tables.

For a little automation project I did, the script needed to process input from a pipe, instead of file. So this updated version adds an "-f" option to get delimited data from a file, or "-" option to get it from STDIN.

Read the rest of this entry...

A shell wrapper script that uses awk to convert a delimited file (where delimiter can be any character) to HTML tables.

Read the rest of this entry...

To export Chrome (or Chromium) browsing history on Linux in a more flexible format than what Settings > History displays, could extract it from the History file, which is an SQLite database.

Read the rest of this entry...

I had a fresh Debian 7 (Wheezy) install on a new server. Some months later, on Dec 21 2013, ran "sudo apt-get update && sudo apt-get dist-upgrade", after reboot, system wouldn't boot, instead dropping me to a "grub> " prompt.

Read the rest of this entry...

The specific use case is that I didn't have Postfix properly configured on some machine to send mail, and it was delivered locally to "/var/spool/mail/root". I fixed the problem by adding my actual email address in "/etc/aliases" such that mail sent to root will now be sent to my email, but would also like the old messages sent there as well.

Read the rest of this entry...

For security, troubleshooting and client billing reasons went to turn on Varnish Cache logging today.

On Debian (should be the same in Ubuntu), with varnish 3.0.4 packages installed from repo.varnish-cache.org, it's all done in /etc/default/varnishncsa.

Uncommented VARNISHNCSA_ENABLED=1, added a custom LOG_FORMAT line with fields I wanted my logs to contain, using the varnishncsa manual page as my guide. Started up varnishncsa with sudo service varnishncsa start, only to find just the first field from my custom log format logged (remote host, or %h, in my case).

Read the rest of this entry...