Tuesday, February 6, 2018

Docker for Script Kiddies

Do you want to easily write some code and run it and not foul up your normal desktop with funky environment variables or versions of scripting languages that aren't officially supported? Yes.

Do you want to use Docker because it is the cool thing that all the other kids are running now? Yes.

Alpine Linux is built to be super super small so it is perfect for things like Docker where you might have a lot of your systems running in parallel. So I build my examples on top of Alpine Linux because why not. I picked the "most popular" programming languages that can be easily installed in vanilla Alpine Linux. This means that Go,  Java, and C# are left out because Alpine Linux uses musl instead of gnu libc and that's not something easily supported out of the box (much respect for Rust for supporting this).

So here are all my GitHub repos with some basic shell scripts for you to run so you can see a HelloWorld run in the languages that are easily supported in vanilla Alpine Linux

GitHub Repos

File Size Comparison

Of all the ways to measure a programming language probably the worst way is to compare the file size needed on disk to get a Hello World program running. But it was easy to do so I went ahead and did it. The base Alpine Linux weighs in at 4.15MB so everything else is on top of that.
  • COMPILER: GCC 6.4.0
    • SIZE: 100MB
  • COMPILER: G++ 6.4.0
    • SIZE: 152MB
  • LANGUAGE: Node.js v8.9.3
    • SIZE: 50.2MB
  • LANGUAGE: PHP 7.1.12
    • SIZE: 14.2MB
  • LANGUAGE: Python 2.7.14
    • SIZE: 44.3MB
  • LANGUAGE: Python 3.6.3
    • SIZE: 55.4MB
  • LANGUAGE: Ruby 2.4.3
    • SIZE: 20.4MB
  • LANGUAGE: Rust 1.22.1
    • SIZE: 267MB

Wednesday, September 20, 2017

Printrbot Auto-Leveling Probe Fix

Has your Printrbot gotten cranky or just given up the ghost when trying to probe your bed?
Is the Printrbot forum not terribly helpful?

My Printrbot would detect the bed in the first spot.
Move to the second spot and go up, up.
Move to the third spot and go up, up.

If your bot acts kind of like this it means that something is wrong with your probe or your firmware or something. Use M119 to see if you can get z_min to be triggered at different positions. In my case it was easy to see that it would trigger near home, but not away so I could tell the probe was broken. Because the only difference was how the wires were stretched I had a strong suspicion it was somewhere in the middle of that wire pull that was getting moved.

None of the other wires in the bundle were having any problems so I don't know why the probe wires are so cheap. Anyway, I did it the proper DIY way chopped out the bulk of the wire and soldered in some heavier duty electrical wires I had laying around.

It looked like this.

I keep the thinner wires on the probe and the connector and soldered there because it was easier that tearing those apart and reconnecting. I fished the probe back into place and it works flawlessly.

I've had 2 different probes fail due to garbage thin wires, but never had a problem with the firmware as some people claim is part of the problem.

So if your probe stopped detecting the your metal build surface you may as well try replacing the wires. It's the maker way after all.

Wednesday, April 26, 2017

Using a Raspberry Pi as an Airplay Server

This is mostly for my own personal notes. Maybe you'll get something out of it.
I've got an original Raspberry Pi B with a WiFi dongle that I have hooked directly to the USB input of my JVC Receiver.

Grab the "Lite" version of Raspbian because you won't need any windows.
At press time the most recent version is 2017-04-10-raspbian-jessie-lite.zip

Setup your accounts/wifi/localization the way you like.
Update and upgrade/dist-upgrade to get everything current.
Reboot to make sure everything is on the level.

Go to: https://github.com/mikebrady/shairport-sync and skim the instructions so you know what you are doing.

Install All The Things!
sudo apt-get install build-essential git xmltoman autoconf automake libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev avahi-daemon libavahi-client-dev libsoxr-dev libssl-dev
Clone All The Things!
git clone https://github.com/mikebrady/shairport-sync.git
Change Directory
cd shairport-sync
Setup Configuration Script
autoreconf -i -f
Configure All The Things!
./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-soxr --with-systemd
Make All The Things!

Create Shairport-Sync Group for Security
 getent group shairport-sync &>/dev/null || sudo groupadd -r shairport-sync >/dev/null
Create Shairport-Sync User for Security
getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
Install All The Things!
sudo make install
Launch on System Boot
sudo systemctl enable shairport-sync
Configure All The Things!
sudo nano /etc/shairport-sync.conf
I added a name to the "general" section
name = "MusicPi";
interpolation = "soxr";
I added some output info to the "alsa" section
output_device = "hw:1";

Thursday, September 22, 2016

Vonets VOPWRT and How I Spent $8

Forgive the brevity. I don't want to waste much more time on this subject
  • I have WiFi.
  • I have a device that is old and doesn't support WiFi
  • I have experience mucking around in OpenWRT and have setup a few devices.

I figured I'd take this bullet list and put it to good use.
I went on eBay and found an $8 piece of hardware that uses OpenWRT. The Vonets VOPWRT. You won't find much information on Google about it. That should have been a red flag.

The first step of this project was to get this VOPWRT box on my WiFi. Start it up. Connect to the config as listed on the bottom of the box and try.

Try it again. Reset the firmware to factory. Try again the next day. Try again a different way. Try again a third way. Try a couple more different ways and fail. Try via command line stuff. Try again. Give up.

Decide to try upgrading the firmware. Checking the OpenWRT wiki where it lists the device. No supported version of it, but what ever. The version with mt7620a_mt7530 in the name sounds promising as it aligns with the specs listed. Download that and attempt to upgrade.

Flash the image to the device. Notice the upgrade seems to go fine. Watch as the device reboots and it is bricked. Open up the box. Notice no screws so you know it is a high quality product. Note the 3 empty antenna structures clearly designed to make you think it pumps out a great signal.

Take out the 8GB MicroSD card.
Throw everything else away.
Vow to not waste your money on more piece of garbage electronics

Saturday, February 6, 2016

Lubuntu Rythmbox Fix for AutoAudioSink and GStreamer

sudo apt-get install gstreamer1.0-alsa

FWIW, this is what happened to me installing Lubuntu 14.04 from a USB stick.

Did you install Rythmbox in Lubuntu and find that you can't use it because you get an error that says "Couldn't start playback" - "Failed to create autoaudiosink element; check your GStreamer installation" instead?

I did, and it was annoying. Couldn't find any real help anywhere no matter how much I searched. Eventually I stumbled across a bug report for it when I used the correct combination of magical keywords (not the autoaudiosink/gstreamer error). Hopefully you find this post faster now and it solves your problems.

The short version of the bug report is that Rythmbox isn't installed by default so they shouldn't support it by default and it acts differently than the audio players they do support, so ¯\_(ツ)_/¯ for now.

Rythmbox is trying to find an interface to output the audio. It knows that GStreamer has been installed and it tries to use it. Lubuntu's installation of GStreamer and fails trying to grab an autoaudiosink, whatever that is.

So you just need to give GStreamer a little something else to play with. Install the ALSA driver (make sure you restart Rythmbox) and go about your buisness.
sudo apt-get install gstreamer1.0-alsa

Thursday, February 4, 2016

The Art of Getting a Deal on a Sleep Number Bed

I've been through the process of buying a Sleep Number bed and in hindsight, this is how you should do it. If I followed these instructions I'd have been better off.

I don't and haven't worked for Sleep Number but the business model is pretty transparent.

Give Yourself a 3-4 Month Window To Buy a Bed

The Sleep Number people want you to buy a bed now. They'll tell you the best sale is right now but the truth is that all their sales are pretty similar. It's your job to take a look at them from a wider view.

Visit a Store with a Reliable Alibi

Get into whatever mall has the Sleep Number store and let the sales person give you the whole 9-yards and let you lay in all the beds. Come into the store knowing you are NOT going to buy a bed. You'll get less of a hard sale from the store if you tell them why you can't buy a bed (you could be closing on a house or moving to a bigger apartment in 2 months and don't have room to store it). Figure out which range of mattresses you prefer. Thank the salesperson for their time as you leave empty handed.

Visit the Website

There is no good reason to buy your bed at the mall store. The prices and discounts are the same and you won't get the hard sell on a new pillow or accessory. Now that you know which mattresses you liked start looking at prices. Ignore the discounted price for now, and assume you'll buy it at full price (but you won't). Still feel good about your possible new bed? Excellent.

Get Historical Discount Data

Remember how I told you to ignore the discounts? That's because they are useless without historical perspective. Does Sleep Number want you to get their historical discount data? They want you to think there is no discount like the discount today. Fortunately, they have a Twitter account dedicated to promoting current deals that you can use to harvest historical data. Did you notice that they tend to have a different mattress on sale each month? Add your favorite mattresses to the cart with and without bases to see how the current discounts size up. Odds are if there is no discount or a weak discount next Month will be better.

Realize the Base is a Scam

You may have noticed that there is some fluctuations in the the discounts, and that's to be expected in day-to-day marketing. But the bigger changes come because sometimes the discounts are on a "bed" and not a mattress. That means you might only get that $600 discount after you purchase the $300 base. Unfortunately, using only the Twitter data doesn't give you these numbers, but looking at larger trends you can make some estimated guesses.

Did I mention the Base is a scam? for $300 you get a big hunk of plastic. For $150 more you can get some legs on it. For less than that $450 you can go to Ikea or Wayfair and get a nice looking platform bed with a headboard and everything.

Check the Discounts Every Month

If you want to sign up for the mailing list or follow the specified Twitter account you can, but you may as well just check in on the website once a month. Every time they announce a new sale add it to your list of historical data. You'll get a good feel for when it's the right time to buy.

Tuesday, March 10, 2015

E3D v6 Hotend on a Printrbot Simple Metal (Introduction)

Welcome True Believers

Congratulations, you typed some worthwhile keywords into a search engine or had somebody recommend this great link. I'm going to assume you've got a working Printrbot Simple Metal and you are looking to upgrade your hotend and you smartly decided to pick the mostly highly regarded hotend on the market, the E3D v6.


I decided to start this journey because I noticed my thermistor seems to change it's mind over time (20 degree difference depending on the day). Did you know the standard Ubis hotend has the thermistor held in place with teflon tape? That's not even real tape, there's nothing to keep it from moving around.
Ubis Hotend Dismantled
You can see in the photo there is a little notch for the thermistor to sit in. It works well enough, but I want something more predicable with true user serviceable parts. I'm keeping my Ubis around because it still works, it's just not great.

Pain Points

The E3D v6 is a great replacement for the Ubis with 3 pain points.
  1.  The hotend is too efficient. It's shorter than the Printrbot was designed for. You'll need an adapter.
  2. The Ubis hotend has some Molex connectors that don't match the raw ends of the E3D v6.
  3. The hotend, like all good modern hotends needs a fan to be running at all times.
  4. The firmware on your board will need to be updated.
The adapter is easy enough to print out as long as you have a working printer. The hotend fan can be hardwired to the main power of your Printrbot and the firmware customization has been documented a thousand times. Don't be afraid. I'm here for you.


  1. Printrbot Simple Metal (with USB cable)
  2. E3D v6 1.75mm Universal (I bought mine from Filastruder.com)
  3. A printed hotend adapter (see Step 1)
  4. A bunch of little bits and bobs for a Molex connection
  5. Needle-nose pliers.
  6. Soldering iron and solder.
  7. A computer (I used OS X, but you can work it out)
  8. (Optional) Scrap of wire and bits of aluminum foil


  1. Print your adapter
  2. Assembling your hotend
  3. Wire your hotend
  4. Test your hotend
  5. Wire your fan
  6. Replace original hotend
  7. Firmware
  8. Autotune 
  9. Final hotend assembly
  10. Adjust your auto leveler
  11. Tweak your slicer
  12. Apply the sticker