Script to fix Yosemite WiFi breakage

Until Apple fixes the buggy Yosemite WiFi driver I’m running this script I whipped up and it’s helping me keep a tenuous grip on what I’m pleased to call my sanity.

It looks for WiFi to drop out of the “running” state and then power cycles it. Works like a charm.

while :
do
    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I |grep -q running

    if [ $? == 1 ]
    then
        # Not running, reconnect
        echo "$(date): WiFi down .. reconnecting ..."
        networksetup -setairportpower en0 off
        networksetup -setairportpower en0 on
    fi

    sleep 2
done

Result:

Fri Oct 31 13:01:01 PDT 2014: WiFi down .. reconnecting ...
Fri Oct 31 13:28:51 PDT 2014: WiFi down .. reconnecting ...
Fri Oct 31 13:31:01 PDT 2014: WiFi down .. reconnecting ...
Fri Oct 31 13:33:01 PDT 2014: WiFi down .. reconnecting ...
Fri Oct 31 13:52:32 PDT 2014: WiFi down .. reconnecting ...

Best thing about it is that I don’t have to download a tool from a .ru domain and run it as root. What could possibly go wrong?

Advertisements

Catfishing For Beginners

This article is interesting on several levels:

  1. Goodreads has trolls, who knew?
  2. It helps one understand how we could have gotten to g.a.m.e.r.g.a.t.e (if the placid pools of literary sites are like this, how could we not?)
  3. The Internet makes people do surprising things (like visiting a troll’s house :-))
  4. It was great to be reminded of one of my favorite computer memes, Eliza (via a roundabout route)

Also, since the article is authored by an actual, um, author, it’s well written and easy to read.

JavaScript Hacks for Hipsters

You’ll either find this amusing or anger inducing depending on your proximity to the software maintenance coalface:

http://www.slideshare.net/berzniz/javascript-40065817

The first one made me cry a little for the rotting corpse of software maintainability but I’ve committed most of the others in various languages.

Using && and || inline is a common idiom in Lua which lacks a ternary operator and #5 is often necessary in Xcode which, bizarrely, lacks any kind of useful bookmarking.