How to do a fast file transfer from a VM to your local computer

How to do a fast file transfer from a VM to your local computer, for example, without the hassle of SFTPing to a third server and setting up a username/password/SSH key-access to it:

yum install
yum install python-pip
curl --output beam
pip install requests==2.8.1
pip install requests_toolbelt==0.3.0
pip install progressbar2==2.7.3
sudo cp beam /usr/local/bin
chmod 755 /usr/local/bin/beam
beam /path/to/file

The first 8 commands are JustBeamIt pre-requisites, and assume CentOS/RHEL. The file expires in 10 minutes.

JustBeamIt Description from Github

Comparing Recharge Times: Sony Wireless Headphones vs. AirPods

From experience, it takes 2.5 hours to recharge Sony wireless headphones (MDR-XB70BT) from empty to full. This is also stated in the manual. The Sonys give 9 hours of battery life for listening. At 3 hours per day of usage, that’s 3 days between charges.

It takes 1.25 hours to recharge the Apple AirPods battery case. They give 24 hours of battery life when new. At 3 hours of usage per day, that’s 8 days between charges of the battery case.

Like all battery-driven headphones, you need to charge more often as the battery ages. After ~1 year of usage, I’ve found I need to recharge the AirPods battery case every 4 days, instead of every 8.

As an aside, I got the AirPods with wireless charging case, and don’t really like the wireless aspect of it. It’s too hard to position the AirPods perfectly on most wireless chargers. Next time, I’ll get the non-wireless AirPods.

AirDrop and VPNs

My colleagues and I had trouble AirDropping files from our Macs to our phones. Sometimes it worked, sometimes it didn’t.

I figured out that AirDrop would fail with the Cisco AnyConnect VPN client connected.

Specifically, when your Mac’s sharingd service tries to connect to https://yourphone.local:8770/Ask to ask for permission to accept a file, it times out via the VPN. This happens even if LocalLanAccess is allowed in your VPN settings.

The solution was simply to disconnect the VPN client whenever you need to AirDrop something.

Unread Mail in Apple Mail

I had a problem for months in Apple Mail (both on the Mac and the iPhone) where multiple folders would show up with an Unread mail count, even if all mail in that folder was already read. If you clicked one of the Unread folders, the Unread count would instantly go away. (But it would reappear when re-opening Mail.)

Here’s how I fixed it:

  1. Open Mail on the Mac
  2. Click on the Archive (or All Mail) folder
  3. Select all mail, right-click on the selected mail, and hit Mark as Unread
  4. Repeat step 3, but now hit Mark as Read

Now close and open Mail again and you will no longer see folders with Unread mail in them. If the problem continues to occur, you may need to repeat steps 2-4 on all of your mail folders.

Eve Room – HomeKit Air Quality / Temperature / Humidity Monitor Experience

I recently received an Eve Room HomeKit Air Quality monitor.  But when I plugged it in, nothing happened.  I let it charge overnight, and it remained stuck on the charging screen. I reset it with a paperclip multiple times.  Tried multiple chargers.  Tried a different micro-USB cable.  All to no effect.  The battery either seemed completely discharged upon arrival, or something was broken inside the unit.

That’s when I emailed Eve Support.  They suggested resetting it again and waiting a few hours.  I did, to no avail.  After I sent them a photo of the non-working unit, they agreed to a quick, free replacement.

And the replacement worked great!

Eve Room (2nd Gen) vs. AcuRite monitor
Eve Room vs. AcuRite monitor (humidity 3% difference, temperature 1 degree difference)

My experience with Volker and Sarah at Eve Support couldn’t have been better.  Polite, prompt, professional, and a free replacement.  I liked their service so much that I went out and bought a second Eve Room for the lower level of my house.  I’m also planning to get one as a gift for a family member.

What does the $85 Eve Room (2nd Gen) get you over a $15 AcuRite?

  • Air quality monitoring via Sensiron metal-oxide based VOC sensor
  • History graphs of your data (see below) – including exporting history to spreadsheets
  • HomeKit support – You can ask Siri to tell you the temperature/humidity/air quality in any given room
  • Automation – In the Home app, you can have an air purifier come on automatically when air quality drops  
  • More automation – In the Eve app, you can add additional automations based on temperature and humidity.  For example, when temp/humidity get above 80F (26.6C), turn on air conditioner.

What are some downsides?

  • Bluetooth-based, which means it takes slightly longer (~1 second) than WiFi-based HomeKit products to display status in the Home app.
  • If you want to access Eve from outside your house, you need a HomeKit hub, such as an Apple TV, HomePod, or iPad.  (In my experience, the Apple TV is the most reliable of the three.)
  • Expensive – $70 more than the bigger AcuRite monitor (though it’s tough to find an air quality monitor with a display for less than $70).
  • Not magnetized like the AcuRite – so you can’t stick it to your refrigerator without adding a magnet.

Charging is easy.  It takes less than 2 hours and only needs to be done once every couple months.  You can also use it with the charger plugged in, though it’s possible this will reduce the battery lifespan a bit.  With the AcuRite, you need to replace the 2x AAA batteries every other year.  (Though my first AcuRite started reporting obviously incorrect temperatures after a few years – I just bought another one since it was so cheap.)

Eve Room Air Quality graphs
Eve Room Air Quality/Temperature graphs in the Eve iPhone app

Are the air quality measurements any good?  The only thing I have to compare it to are the measurements from my Withings scale downstairs.  The Withings reacts pretty fast to cooking in the kitchen.  The Eve Room seems to be a bit more … optimistic on air quality, even when the air seems a bit stale.  (a quick blast of the air conditioner clears this up though)  It doesn’t care much about soiled diapers, but it does react when people are in the room breathing out carbon dioxide for half an hour or so.

Overall, fun little gadget, and I’m looking forward to setting up automations with it!

How to Get Printer Stats (Page Count, Drum Unit Life, Toner Remaining) from Dell Laser Printers

I have a small Dell E310DW laser printer, which is a rebranded Brother L2340DW wireless printer.  Bought it for $90 three years ago.  Today, I discovered the printer’s internal status page.  Here’s how to get to it:

  1. With the printer on, go to http://dell5bbcd8.local./general/information.html?kind=item (this address may be slightly different depending on whether you have a Brother or Dell printer).  Not sure if part of the address is randomized though.  If it doesn’t work, try putting your printer’s IP address in your web browser’s location bar.
  2. You’ll see a page that looks similar to the one below.  You can go to the home page to see the amount of toner printer info.png

You can also get this info by doing a status print out.

After I bought this printer, I sold my old non-wireless HP LaserJet P1006 printer for $40 on Craigslist.  Even though it needed toner, I still had 4 people competing to buy it.

A few more things I love about this Dell/Brother laser:

  • Fast duplex printing (prints on both sides of the page to save paper)
  • Works wirelessly with no software to install on Macs, iPads, and iPhones
  • You can continue printing even beyond the toner’s estimated print life by enabling “Continue Mode“. Use the printer controls on the printer itself, or log into the printer web management (described above), and set the replace toner option to enable this mode.

After 3 years, I’ve printed 265 pages.  That’s 88 pages a year, or 7 pages a month.  I have roughly 60% of my “starter toner” remaining.  At this rate, I’ll be be able to use the original toner for at least another 3-4 years!  This would be unheard of in the inkjet world.

What Happens When You Request a Web Page

Say you want to go to What happens under the hood after you type the page’s address into your browser?

  1. DNS lookup:
    1. DNS caches are checked: browser cache, operating system cache
    2. Local computer’s hosts file and the router’s cache are checked
    3. Local computer’s resolver config is checked for the address of the recursive DNS server (ex. ISP’s DNS server).  That server’s cache and records are then checked for, usually via UDP port 53.

      Image credit:
    4. Root DNS servers for .com are checked
    5. Top Level DNS servers are checked
    6. Authoritative DNS servers are checked
    7. If the record is found, the result is cached by the recursive DNS servers and your local system
  2. Browser sends HTTP request to the IP returned by the DNS server:
    1. Makes system call to the operating system’s kernel to create a TCP internet socket (fd = socket(AF_INET, SOCK_STREAM)
    2. Connects to a port (ex. 80) on an IP (from DNS) (fd,
    3. Makes a request (write (fd, "GET /index.html HTTP/1.1)
    4. Reads the response (index.file=read(fd ...))
  3. Server responds and sends back the requested HTML file
  4. Browser renders HTML
  5. Browser sends additional requests for objects embedded in the HTML file (ex. CSS files, images, JavaScript, etc.)

I used the following resources in researching this:

Jeff Smith’s DNS Explained tutorial
Steven Bradley’s What Happens When Your Browser Requests a Web Page
Julia Evan’s Bite Size Networking wizard zine

Hope this helps anyone curious for a deeper level understanding of this!

Update: A week after posting this, I happened across a page dedicated to explaining this process in exhaustive detail, right down to what happens when you press the first key!  (on a physical or virtual keyboard)

Troubleshooting Networks – Layers 4-7 in the OSI Model

I was recently asked how to troubleshoot layers 4-7 of the OSI model.

Lower layers are drawn wider to show protocol encapsulation

Layer 4 (Transport) : Most problems at the transport layer have to do with blocked ports.  Ensure there are no firewalls (ex. iptables) blocking the TCP/UDP ports you’re trying to troubleshoot.  You can also try temporarily disabling quality of service (QoS).

Layer 5 (Session) and Layer 6 (Presentation) : Example protocols in these layers include sockets in the session layer and MIME in the presentation layer.  These two layers play a less active role in the functioning of the network compared to the other layers of the OSI model.  There usually isn’t anything here to troubleshoot.

Layer 7 (Application) : The app layer is where client-server apps are used.  For example, HTTP, HTTPS, SMTP, SSH, DNS.  Regarding DNS, use the dig or nslookup commands as a starting point to figuring out why DNS is failing.  For HTTP, you might use Apache’s or NGINX’s stats pages.  (Be sure to turn these off when you’re done using them though, for security.)  For SSH, SMTP, and all cases: check the logs.  Temporarily enable debug logging if you have to.  You can also use tcpdump to filter TCP/IP packets and analyze the protocols used.
There is certainly more that could be said here, but I just wanted to write down what I’ve learned so far.  Credit for much of the above info goes to:

Sukesh Mudrakola at Techgenix
Brendan Gregg’s book on Systems Performance

Troubleshooting Why My Mac Was Slow: photoanalysisd

I woke my Mac after it had been sleeping for a while and I noticed it was slower than usual.  Clicking browser tabs felt like pushing through molasses.

I opened a Terminal window and typed: top, and immediately1 saw photoanalysisd consuming 95% CPU.  It showed no signs of letting up, after several minutes of watching it.

  • What was it doing?
  • Wasn’t photo analysis only supposed to happen when your Mac is idle or in PowerNap/sleep mode?

I opened Photos.  Now two CPU hungry processes were going: Photos itself and photoanalysisd.

After a quick web search, I went straight to the first hit at Stack Exchange, and found this gem:

  1. Start Photos, let it continue past the first dialogue box;
  2. Now Preferences in the app menu is clickable (if it wasn’t before);
  3. Preferences > General , and untick both check boxes in Memories;
  4. Close Photos.
    This stops photoanalysisd cold, no reboot or kill required.

Untick these two boxes in Photos > Preferences > General > Memories

Not sure how this guy figured this out, but this tip worked great.  It did indeed stop photoanalysisd.  Hopefully this trouble won’t crop up again.

Interpreting vmstat (virtual memory and system statistics)

I was asked about vmstat recently and didn’t know as much as I should.  I’m writing a brief post to help myself learn it a little more.

Here’s an excerpt of the manual:


So what can you do with vmstat?  If you run it without specifying any parameters, it gives you an average view of virtual memory and system usage since your last reboot.

If you run it with the 1 parameter (vmstat 1), it runs (and re-measures) every 1 second, until you break out of it:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0      0  44712 110052 623096    0    0    30    28  217  888 13  3 83  1  0
 0  0      0  44408 110052 623096    0    0     0     0   88 1446 31  4 65  0  0
 0  0      0  44524 110052 623096    0    0     0     0   84  872 11  2 87  0  0

If you want to see how much memory is swapped in/out from disk, check out the si/so (swapped in/swapped out) columns.

If the amount of memory in the free column is low, you’ll want to check which processes are consuming the most memory.  (with top, for example)

But wait – you can also troubleshoot CPU and disk bottlenecks with vmstat:

For disk bottlenecks, look at the b (blocked) column.  This tells you the number of threads that were blocked/waiting on IO completion.  It should be 0 most of the time, but if it’s not, you can investigate further with iostat.

For CPU bottlenecks, look at the r (run queue) column.  These are the threads that were waiting for a CPU to become available in order to run.  If you see more than 2-5 times the number of CPUs on the system listed in this column, there may be a CPU bottleneck.

For more info, see The Geek Diary’s guide to troubleshooting with vmstat – it’s an excellent resource.  And if you want to know how to run something slightly similar to vmstat on macOS, try vm_stat.