Author Archives: Kevin

Using Netatalk & CUPS

Using 20+ year old hardware is as much a curse as it is a blessing.

Set-Up:

Imagesetter (AccuSet 1000) – RIP (PowerMac 7500) – CUPS server (Raspberry Pi) – Clients (OS X 10.5, macOS 10.12)

The OS X 10.5 client currently serves as an MDNS print server for the newer OS machine since that is the last Macintosh OS version to speak AppleTalk, which the even older RIP requires (thankfully via ethernet).

In this day and age OS X 10.5 (Intel) has nothing close to a modern web browser. Thanks to the incredible persons at floodgap.com, 10.5 on PPC does in the wonderful TenFourFox, which (as its name implies) means OS X 10.4 has a more modern web browser than 10.6. Hell, Mac OS 9 has Classilla (progenitor of TenFourFox). In a perfect world I would use the 10.5 machine as the server for a newer, betterer everyday workstation, but that money doesnt exist. So out comes the Raspberry Pi.
Continue reading

Postfix PCRE TLD body check

This is used to reject spam e-mail containing a URL to the top level domains .date or .loan, and can of course be modified to include others. If you feel your users may ever have a legitimate need to be contacted about these domains it would be best to not use this.

Some familiarity with perl compatible regular expressions in postfix will be helpful.

/https?://([a-z,0-9,-]+.){1,3}(date|loan)// REJECT

This pattern matches both http and https protocols, and links containing from 1 to 3 subdomains of the TLD (http://3.2.example.com/ or https://example.com/ would match were .com the target).

Insert that line into your custom body checks file and no more spam du jour. Enjoy.

Parse e-mail for UPS tracking numbers

This AppleScript will parse the selected e-mail in Mail.app for UPS tracking numbers and will open the tracking page of the UPS website in your default browser.

This only looks at a single e-mail, but could be made to repeat through multiple selections.

tell application "Mail"
  set _messages to selection as list
  set input to content of item 1 of _messages
  try
    open location my parse_nums(input)
  on error
    display dialog "No UPS tracking info found."
  end try
end tell

on parse_nums(input)
  set input_new to ""
  set output to ""
  set input to every word of input
  repeat with i in input
    try
      if first character of i is "1" and second character of i is "Z" then --Every UPS # I've seen starts with '1Z'
        set input_new to input_new & i & "%0D%0A" as string -- 
URL encoded carriage return line feed needed for multiple entries.
      end if
    end try
  end repeat
-- Now to remove the last set of new line characters.
  repeat with c in characters 1 through ((count of characters of input_new) - 6) of input_new
    set output to output & c
  end repeat
  set the_URL to "https://wwwapps.ups.com/WebTracking/track?track.x=Track&trackNums=" & output
  return the_URL
end parse_nums

Set creation and modification date

This is to correct file times on photos that were imported from cameras with bad date settings or when they have been transferred to-and-fro and picked up the wrong data some where or after re-encoding high bit rate video to save a few GBs. [This does not alter the date atoms encoded in (most?) video files. ffmpeg can do that, however.]
Continue reading

OS X Server 5 Shenanigans

OS X Server 5 for OS X 10.10. and 10.11, while a significant improvement to Lion Server for OS X 10.7, still behaves oddly when mixing SSL and non-SSL requests. Whereas before it wanted every request redirected to the SSL pipe, now it will let you do either. It won’t, however, let you do both.

WordPress will try to do both. Why? I dunno. It should work, and did on plain Apache 2, but OS X Server 5 puts up a proxy to the WAN and serves from a different port. This is not presented upfront to the Server.app user, but is most likely in the docs. RTFM much? Ha-ha! No.

The affect this had on my WordPress install is instead of logging in being presented with a page that merely stated,

You don’t have permission to view this page.

Or some such equally helpful information. A little web searching turned up the answer. To overcome this the following can be added to wp-includes/http.php

/* Adding this BS for OS X Server 5 being a dick... */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $_SERVER['HTTPS']='on';
}

I saw a post on wordpress.net that said to put this into config.php, but that did not work for me. Neither did the mod_rewrite mumbo-jumbo in that thread and apparently it didn’t for the OP, either.

I admit being ignorant to what HTTP_X_FORWARDED_PROTO is, but it appears to be a HTTP header from an Apache mod Apple is running. Unique to them or something well known? I dunno. I don’t pretend to try to keep up with this stuff any longer. That’s why I went to WordPress; So I wouldn’t have to.

Number 1!

Number 1 in town for the National Bike Challenge.

20130701-085836.jpg
Of course this is first thing in the morning of the 1st day of the month and no one else had logged any miles, but still…