Category: Work

Radio Milwaukee AppleScript

I’ve been listening to Radio Milwaukee a lot lately. They play it at a lot of my favorite coffee shops in Milwaukee that I haven’t been able to visit for a while.

I like to listen to music in the Music app (previously iTunes) because I have AirPlay speakers in my office and around the house. This script opens the Radio Milwaukee stream and hides the Music app.

tell application "Music" open location "" play set visible of every window to false end tell
Code language: AppleScript (applescript)

IPv6 PAC Support

If you’re not familiar with a Proxy Auto-Configuration (PAC) file, it’s a JavaScript function that determines whether web requests should be forwarded to a proxy server or not.

There’s a minimal set of JavaScript functions defined that you can use to conditionally send your web traffic through a proxy. One of those functions, isInNet(), returns true if an address (an IPv4 address) is included in a given network range. Unfortunately there are no functions in this standard set that provide similar support for IPv6 addresses.

There are many IPv6 parsing libraries on GitHub, but all of them depend on at least a few npm packages. I’m normally not one to complain about npm dependencies, but this is once instance where the dependency model is not really tenable.

Here I’ve put together a copy/pastable inIPv6Range() function that provides limited functionality for determining whether a given IPv6 address is in a predetermined range.

function expandIPv6( ipv6 ) { const parts = ipv6 .replace( '::', ':' ) .split( ':' ) .filter( p => !! p ); const zerofill = 8 - parts.length; // Fill in :: with missing zeros return ipv6 .replace( '::', `:${ '0:'.repeat( zerofill ) }` ) .replace( /:$/, '' ); } function parseIPv6( ipv6 ) { ipv6 = expandIPv6( ipv6 ); // Check is valid IPv6 address ipv6 = ipv6.split( ':' ); if ( ipv6.length !== 8 ) { return false; } const parts = []; ipv6.forEach( function( part ) { let bin = parseInt( part, 16 ).toString( 2 ); while ( bin.length < 16 ) { // left pad bin = '0' + bin; } parts.push( bin ); }); const bin = parts.join( '' ); return parseInt( bin, 2 ); } function inIPv6Range( ipv6, low = '::', high = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ) { ipv6 = parseIPv6( ipv6 ); low = parseIPv6( low ); high = parseIPv6( high ); if ( false === ipv6 || false === low || false === high ) { return false; } return ipv6 >= low && ipv6 <= high; }
Code language: JavaScript (javascript)

If you clean this up or add CIDR support, let me know!

Five Tips from Five Years of Remote Work

I’ve worked from home for a long time now. Forever, really — Automattic was my first real job after college. In a lot of ways, I work similarly to the way I did in college except that I go to a coffee shop instead of a library.

When I started working from home, I noticed people were very concerned that it would be too challenging. I’ve gotten used to the questions, and over the years, I’ve refined my answer to a handful of main points.

  1. Get out of the house most days. Whatever that looks like for you will depend on how you work best and how much you like to interact with other people. It could be going for a walk around the block, spending some time in a coffee shop, or spending the whole day in a co-working space.
  2. Try to follow a routine. Going back to the first point, it helps me to take a walk to a coffee shop every morning. The ten minute walk to the coffee shop is sort of like my commute and defines the start of my day. When you work from home, it’s easy to forget when it’s time to “go home” for the day. Having a routine to start and end the day helps with that.
  3. Take advantage of the flexibility. Like anything, working from home has pros and cons. One of the advantages is the flexibility you get, so use it! I try to get out of the house most days, but I also have the option to stay in if it’s particularly cold or there’s a blizzard and I don’t feel like walking through the snow.
  4. Set up a nice home office. I think a nice chair is a minimum requirement. Don’t cheap out here. It will pay for itself in chiropractor bills. I also like a desk that can convert to a standing desk. There are a lot of fancy automatic options, but I personally recommend saving some money and getting one with a manual crank. I need a nice monitor and noise canceling headphones. Again, do what works for you.
  5. Meet people outside work. Joining a co-working space can be a nice way to do this, but you could join a basketball league or organize a local Internet of Things meetup — whatever interests you. Joining a new company can be a big transition. Especially if you’ve just graduated and many of your friends are moving across the country.

I also like to make a distinction between distributed companies and remote workers. Automattic is a distributed company. Everyone works from home — or wherever they feel most productive. Sometimes people work from home, but in a company where most people are colocated in one or several offices.

The difference might not seem obvious at first, but I think it’s important because it can be a defining factor in how the rest of the company communicates with remote workers. Since we’re all distributed at Automattic, there’s no way to overlook someone who is remote. If most of your company is colocated, it helps to understand how the rest of the company thinks about communication.

Working from home is great. My colleagues sometimes say that they’ve broken me — remote work is all I know. I’m not sure if I could work in an office every day, but maybe someone else can write that blog post. 🙃

San Francisco Panoramas

Last week I was in San Francisco for a team meetup. I’ve been taking a ton a panoramas since I realized there’s an album dedicated to them in iOS. Here are a few.

Interestingly, this is the first time I’ve been to “the office” in almost a year and half.