Wednesday, January 5, 2022

A quickie: cleaning up and automating your Mac taskbar

I just set up something really slick on my Mac, so I thought I'd share.  I'm sure I'm not the only one with too many items at the top of my Mac's screen.  The more things you're running, the more cluttered it gets to the point of being nearly useless.  The best way I've found to tame that is another app.  Yeah, I know - it sounds counterintuitive, but hear me out; and don't forget the phrase "fight fire with fire".  So, that app is Mac Bartender, and it's about the best $15 you'll spend on your Mac.  It works by moving apps, icons, alerts, etc into sub-taskbar that only shows up when you ask it to, and it also lets you rearrange their  ordering.  Best of all, it can automatically unhide icons when you want them.  The simplest way is to have the application's icon reveal itself when changes - and that works reasonably well for most things, like wifi indicators, changes to your cloud folders (Nextcloud, Dropbox), or backups starting/finishing - but sometimes you want an icon to appear even if it hasn't changed, so Bartender lets you create a shell script as a trigger.

Want an example?  That's the purpose of this post.  (No credit for guessing that.  Too easy - no style points.)  I'm using a small AI app,, to clean up audio for Zoom, FaceTime, Signal, Skype and friends.  You should check it out, by the way - it's shockingly good: even with my mic inches from a (very noisy) mechanical keyboard, no one else can hear a single keystroke.  Krisp recently added video cleanup, so I'd like the Krisp icon to be visible in the taskbar whenever I'm on a call.  A 1-line shell script to the rescue.  Now, instead of having Krisp unhide when its icon changes, Bartender runs the following command every 30 seconds:

ps x | grep -v grep | egrep -q "zoom.*evt" && echo 1

That's Linux/Unix speak for "check whether Zoom has a meeting running, and if so print the number 1", which tells Bartender to keep the Krisp icon visible in the task bar.  Simple, easy and very effective.

If you're using tools like this I'll be glad to help you configure them. And if you have other suggestions, big or small, to how to make life a bit easier, please share them! You can leave a comment, write a full post here, or let me know the details and I'll do the writing. 

Happy automating!

Thursday, December 30, 2021

Run 2 octoprint instances on one machine (1/?)

Earlier this year I decided that the Ender3 needed a friend, and since I really liked having a larger printer in the house when I borrowed the CR-10Pro last summer, I got a Tronxy X5SA-Pro.  It's 330x330x400, Core-XY and comes with a fancy touchscreen.  It also has wretched firmware that has a hard time remembering even simple settings, like Z offset.  Next chance I get I'm going to compile Marlin, but for now I'm muddling through with what's there - thanks to Octoprint.  The Ender has been connected to a Raspi4 running Octoprint almost since I bought it, so I can't deny Tronx the same pleasure, especially since the Raspi4 has more than enough power to run both printers and multiple cameras simultaneously.  Thomas Messmer put together a VERY detailed walk-through which was a huge help for me, though it's aged a bit and some of the information is now out of date.  Well, that's where this blog comes in.  Over the next few posts I'll take you through what's different and how to use his instructions with current versions of OctoPi and OctoPrint.  

First, we'll address the migration from init.d to systemd.  Sidestepping the controversy of systemd (like how I did that?) here's my reply to the most recent question, as of the end of December, 2021:

Once you have the second instance of Octoprint running, set up the second systemd file.  I'll copy mine below for reference:

  1. Copy /etc/systemd/system/octoprint.service to /etc/systemd/system/octoprint2.service
  2. In octoprint2.service, update variables "User", "Port", and "ExecStart".  Pick any unused port and that's what you'll put into haproxy later.
  3. Tell systemd to pick up the new script: "sudo systemctl daemon-reload"
  4. Activate it: "sudo systemctl enable octoprint2"
  5. Start it: "sudo systemctl start octoprint2"
  6. Debug and find your typos. 
After that, it should just work.  Future posts will cover:
  • Creating that second instance (though I'll be making minimal additions to the standard Linux instructions.)
  • Setting up haproxy
    • Bonus: I have DNS aliases for the Raspi so I can point a browser at ender.${my_domain} and tronxy.${my_domain} without having to remember what port they're using
    • I'm also using letsencrypt wildcards for ${my_domain} so the browsers are happy.
  • Nailing down the /dev entries so that Octoprint can find the printer and camera(s) it expects to.  This caused problems for me every time I rebooted the Raspi, or even if a USB cable got jiggled, so I'd like to save you the trouble. 
  • Anything else?  Let me know!

My octoprint2 service file:

$ cat /etc/systemd/system/octoprint2.service


Description=The snappy web interface for your 3D printer






ExecStart=/home/octo2/oprint/bin/octoprint serve --host=${HOST} --port=${PORT}


Tuesday, July 20, 2021

More 3D Printer Tips

What? More Of The Same?

Nope!  After a year and a half with the printer(s) I find myself being asked for advice about buying a printer and what to do when that advice is taken.  So, rather than repeating myself in email, I figured I'd post a quick update.  If you don't have a 3D printer, I'll understand if you sto... hey - you already stopped? Well, ok.


Microcaliper ($20) - I'm not sure how I missed this the first time.  I use this thing a LOT.  Not just for prints, but once you can measure something to within 3/100th of a mm, the tool makes its own jobs: how thick is this credit card?  Why does this paper feel so light?  Is resume paper really thicker?  The cheaper models only measure down to 0.2mm, but you want to get finer than that.  You can spend more, but it won't really be useful here.

Nozzle/Cleaning Needle kit ($8) - Brass nozzles wear down and, more frequently, get clogged, so you'll want to have some spares on-hand.  But before you toss a nozzle you think is clogged, try cleaning it.  The needles in this kit are precision-made to make sure they don't enlarge the nozzle's opening.  They're also a great way to test your new nozzles to make sure the opening is as big as it should be, which is just what I did after ordering a cheap pack of 20 0.4mm nozzles.  In that bag, only 9 were ready to go immediately, 7 needed some assistance from a 0.4mm needle to enlarge the opening and 4 had holes too small to be opened at all.  The kit I linked above also includes a variety of nozzle sizes.  Why would you want a bigger one?  They print faster at the expense of appearance.  You can also go smaller to get really fine layers.  Just make sure you get nozzles compatible with your printer.  This pack will work with many Makerbot, Creality and Prusa, but I make no guarantees.  

Splurge Nozzles (variable) - I've been printing for over 18 months and the only reason I've had to discard nozzles is clogging - I've never worn one out, but it is possible if you print a lot.  You can spend a bit more to get stainless steel ($7 each ) instead of brass, which not only last longer, but will let you print with more abrasive filament like carbon fiber, fiberglass, etc. Make sure to read the reviews carefully - cheaper ones are usually junk.  You could also go all-in and get a ruby nozzle for $100, but if you do, make sure you get a real one.  The $60 nozzles appear to be junk too.

What To Print First

(Ok, maybe that should be "what to print second")

Sure, go ahead and print your Benchy.  It's a rite of passage.  After that, though, you're going to want to learn more about your printer and dial it in to get better, more reliable prints.  There's a slew of parameters which can make a huge difference, so the only way to find those is testing: starting temperature, 1st layer temperature, bed temp, 1st layer bed temp, print speed, retraction distance, retraction speed, etc. Here are some of the tests I've found most useful:

  • Retraction test suite : One of the easiest ways to ruin a print is stringing which is just what it sounds like: strings of filament all over the print - caused by molten filament oozing out of the nozzle while the head moves to the next place it wants to print.  To prevent that, the printer can retract the filament just before it moves, but how much? How fast?  Retracting too much will jam the nozzle.  Retracting too fast can break the filament.  Retracting too slowly or too little will cause more oozing.  This pre-sliced test suite will help you determine speed and distance with a bunch of pre-sliced gcode files.  Be aware that these use a nozzle temp of 200C, so if you want it higher you'll need to either edit the gcode (it's easier than you think), adjust on the printer while it's going, or - better still - use Octoprint as described in my last post.  That said, here's how I suggest using the test suite for a standard print head (as opposed to all-metal), with a Bowden tube:  
  • Print SpeedTest_speeds-6mm.gcode then pick the speed that looks best for the rest. All other things being equal, faster retraction is generally better because it saves time.
  • Using the speed you chose above, do the 2-10mm distance test to narrow down the distance range.
  • Now that you have the range, choose a finer distance test, e.g.: 2-5mm, or 3-8mm.  Unless your printer is direct-drive, you probably won't be in the 0-2mm range. 
  • With your chosen distance, redo the speed test at *that* distance.
  • Use that retraction speed and distance in your slicer.  

  • Temperature tower : Another important one, this time to find the best temperature. Higher temps stick to the bed better, but usually cause more stringing and tend to be a bit shinier.  Of course you want the print to stick to the bed, so your slicer will let you print the first layer at a higher temperature.  I usually go with 10-15C higher.  Much like retraction, the optimum temperature will vary by filament brand, though it's pretty consistent within the same brand.  Note, that this test is not pre-sliced, so you'll need to edit the gcode to adjust the temperature at each floor after you've sliced it.  (Perhaps my next post should be a primmer on editing gcode.  Hmm...)

  • XYZ 20mm calibration cube : Helpful to find layer shifting and check accuracy with the micrometer I mentioned above.  This is one of the first tests I do when trying a new filament brand or material.

  • Stackable calicat - cuter version of the cube, which can also stack on top of each other.   

  • Spiral Thing : Excellent test of temperature and stringing. If you can get this to come out cleanly and without stringing, you know you've nailed it.

  • All-in-one test : Great way to test a bunch of things at once, especially how well your printer handles overhangs and bridging - basically printing in mid-air with nothing below it.  A properly-tuned printer with good print filament cooling can bridge much farther than you'd expect.  Make sure to read the instructions because it's going to require some fiddling with the slicer.  

  • Mini all-in-one test : If you're just getting started or don't want to deal with support blocking, you can start with this guy.

  • Slicers

    I use Prusa Slicer and Ultimaker Cura. Both support a wide range of printers so there's no need to stick with a slicer with the same name as your printer. Prusa tends to print faster, but Cura does a better job, especially for complex prints and things that need support - their tree supports are MUCH better than anything else short of having two nozzles (which lets you print supports with a filament that dissolves in water.). Both programs work fine with their default settings and are insanely tunable when you're ready to go deeper. They both output gcode, of course, and their save files are compatible, so you can go back and forth with them to see which you prefer.

    A Few More Tips


    I love Thingiverse and never cease to be amazed by what's posted there.  However, sometimes you'll download a Thing and later when you go to print it you'll find that the README.txt file is useless so you don't know what settings the designer suggests. So, as soon as you download the zip file, open it up and look at the README.  It should have the URL to the Thing and the full contents of the "Thing Details" for that Thing.  If it doesn't - add it.  Trust me, you'll be glad you did.


    As for organizing your downloads, well, that's a tougher one.  I split them into directories: tools, mods (printer modifications, gifts, models, etc.  And in MacOS, I use tags on the Thing directories to note whether I've printed that particular item.  Using Windows? Well, you could rename the directory instead.


    As with any scientific endeavor, you only want to change a single variable at a time when trying to fix or improve your prints.  One of the best things I've done is create a spreadsheet for everything I print, and I name the slicer's save file (*.3mf) with the slicer, printer, name of item and line number in that spreadsheet. e.g.: cura-e3p-sunglasscarclip.206.3mf.  Columns in the spreadsheet are: item, printer, slicer, layer height, wall count, infill %, print temp, 1st layer print temp, bed temp, 1st layer bed temp, print speed, 1st layer print speed, mm retraction, adhesion (brim, skirt, raft), slicer time estimate, slicer weight estimate, print spool, file name, changes since the last iteration (if any), start date/time, print time, actual weight, results.  Sure, it's a lot to track, but this way I make one change to the print and I can see the results.  I'm also using Octoprint plugins Print Job History and Filament Manager, which keep track of a lot of that automatically, as well as taking a picture with the RaspiCamera so I can see it later.   In case I haven't mentioned Octoprint enough, let me recommend it once again.  Don't want to buy a Raspberry Pi?  Run it on an old laptop!  I did that for a while and it worked like a charm. 

    Thursday, July 9, 2020

    3D Printer Upgrades, Tweaks, Tips and Tricks

    I'm Back!

    Hello, all (few dozen remaining) readers.  Yeah, I've been away a while because I didn't think I had much to add.  Well, the last few weeks I've picked up a new hobby (no points for guessing it - I'm assuming you've read the title of this post) and several people have asked for more detail about the upgrades and other things I've done.  Instead of emailing it to each person, I decided to post here for all to see, watch, and pick apart.

    If you don't know what a 3d printer is, you're probably reading the wrong blog.  It's ok, Facebook is right over there; and Instafacegram is right next door.  For the rest of you...

    NOTE: This is a work in progress, so while there's some (hopefully) useful information here, it's not finished, so please remember to check back!

    Picking A Printer

    I've been looking for an excuse reason to buy a 3D printer for years, but couldn't quite rationalize justify it until recently when my cousin told me he was printing PPE for first responders and other folks on the front lines of the COVID19 pandemic.  Being cooped up and still able to help out?  Sign me up.  So, the next thing to do was learn everything I could, starting with what printer to buy.  I'm on a small mailing list with a lot of other geeky types and I know several of them have 3D 
    printers so I asked for their advice.  Ultimately I decided on a Creality Ender 3 Pro, mainly because of the larger Y-axis gantry and better power supply.   At under $250 it's a great entry-level unit that will still print well enough to use for a while.  I also figured it would be an excellent learning platform considering how broadly they're loved and supported by the community.  Not long after buying it, I was into add-ons and upgrades: some it printed for itself, while others were bought on-line.  Most have been well worth the investment and that's where I get most of the questions.  So let's dive in.

    Enhancement Summary

    I'll go into more detail below, but for the tl;drs out there.  All prices are on Amazon (links are direct, not affiliate links) unless specified otherwise. 

    1. Octoprint (free) on a Raspberry Pi 4 (Amazon: 2GB RAM:$45, 4GB RAM: $60. Microcenter is $10 cheaper than Amazon, but only has them in-store, so if you have one near you: $35 and $50, respectively).  My recommended plugins are listed below.
    2. Bigtreetech SKR Mini e3 v1.2 ($38) - v2.0 just came out with some minor improvements, so if you want to splurge, it's (an extra $7).
    3. AntClabs BLTouch self-leveling sensor (Amazon: $53)
    4. Better filament snips ($8)
    5. Tempered, treated glass bed (Amazon: $20; Aliexpress has these too, but I haven't tried any so can't attest to the quality.)
    6. Dual-screw, all-metal extruder assembly ($15)
    7. Stiffer bed leveling springs (16 for $8. So you have 12 spares, for this maybe?)
    8. Exacto-like knife with comfy handle ($8)
    9. Capricorn PTFE Bowden tube ($7)
    10. Bigtreetech Smart filament break sensor ($20)
    11. High accuracy scale ($15)
    12. Raspberry Pi camera with night vision ($16) with 1m cable ($5)

    External Upgrades 

    (IOW: Not right on the printer.)

    Octoprint on a Raspberry Pi 4

    What and why

    If you're looking for a way to both simplify your printing experience, but also expand the capabilities and really see what your device can do, this is the first thing I would do.  I've had Raspi's for years, starting with version 1 (which is still humming along in the basement).  The Raspi2 is a DNS proxy, The Raspi3 was running home-assistant, but died a few months ago, and I have a Raspi0 managing and watching my garage doors.  Just like with the printer, I've wanted a Raspi4, but didn't have a good reason until now.  The 4 has plenty of power and mine is actually running two Ender 3Pros (long story) without any effort.

    Octo, which is free, will manage your printers, keep track of prints, allow for on-the-fly adjustments, alert you when a print is finished or there's a problem, and a LOT more.  The basic functionality is phenomenal and the add-ons make this a no-brainer. I have a Raspi camera attached to the cross-X bar at the top of my printer so I can monitor it remotely and it takes a picture after each print before saving the details.  I got the one with GB of RAM, but you'll be fine with 2GB if you want to save a few $.  

    Recommended plugins:

    In rough order of how much I love them, from "can't print without it" to "extremely useful.
    1. Filament manager - Track spools including remaining filament; know how much is left in that spool on the shelf. Better still, set it up to use Postgres so that multiple Octo instances can share. This is one of my favorites.
    2. Bed Visualizer - If you have an automatic leveler, like a BLTouch (more on that later), this will generate an image of your bed topology, which is a HUGE help in knowing why things aren't sticking, and choosing where to print small, sensitive items.
    3. BLTouch plugin - for managing that automatic leveler 
    4. PrintJobHistory - Save details on everything you print, including the photo I mentioned earlier. 
    5. Pushover - get alerts sent to your phone, computer, watch, fillings in your teeth, etc. (I'm kidding about the teeth - or am I?).  I've been using Pushover for years to get alerts for other things, but even if you have to create an account now, it's simple and well worth it.
    6. Cancel Objects - Lets you cancel an individual item being printed without stopping the whole job. Like when one of those frames starts to peel, I can cancel that one, remove it from the bed then let the printer continue with the other.  You may need to tweak your Slicer's settings, but that's explained well in the plugin itself.
    7. Cost Estimation - get a good idea of how much that print is going to cost before you start.
    8. Octoprint-WideScreen - If you have a widescreen monitor this is a better layout
    9. Smart Preheat - Adds a preheat button to get the bed and nozzle up to temp faster
    10. TemperatureLegendMover - Moves the temperature legend to where you can see it. Minor improvement, but well worth it.

    Internal Upgrades You Buy

    These items you will probably have to buy.  Ok, you could make a few of them, like using your (now-retired) Z-stop as a filament sensor, but in general, these will cost you a few bucks.


    Tempered, treated glass bed (Amazon: $20) - One of the Ender 3 Pro's upgrades over the Ender 3 is the magnetic build surface that makes it much easier to remove prints that can get stuck on other surfaces. It's ok but sometimes works too well so I ended up scraping things off it, sometimes damaging prints in the process.  Plus you should relevel the bed every time you remove the surface, which is a PITA.  The printers I'm fixing both have glass beds, which are a dramatic improvement.  At 40C+, prints hold on very tightly but at room temperature, they almost fall right off.  The bed I bought, and which is linked above, is even better than the Creality-branded parts that came on the other two printers.  My E3P is printing PPE face shields, two at a time, as fast as it can, and with this bed I almost never have frames pop off (which is very common) and once the bed cools to room temperature a stiff breeze would slide them off.  I can't say enough good things about it.  Tip: make sure your Z-offset is spot-on, your bed is leveled and clean, then print the first layer at 70C and the rest at 50C.  

    Dual-screw, all-metal extruder assembly ($15) - The loaner CR10S-Pro comes with this, but I wasn't sure how much of a difference it really made.  I did notice that it seemed to extrude more smoothly and that the filament had fewer bite marks, for lack of a better term, in it, so I figured I'd give it a shot on my E3P.  Boy was my skepticism shot down.  My printer was working well before I installed this, but this turned it into a rockstar.  Those visor frames I keep talking about?  They come out absolutely flawless: no burrs, no stringing, no blobs.  

    Bigtreetech SKR Mini e3 v1.2 ($38) - v2.0 just came out with some minor improvements, so if you want to splurge, it's (an extra $7).  You wouldn't think that a new controler board could quiet motors, but you'd be wrong.  This has a much more powerful 32-bit microprocessor than the 8-bit that comes with the Ender3, which allows it to keep a much closer watch on the printer and make much finer adjustments.  In fact, that's why it's so much quieter: it moves the motors in much smaller steps, which also gives it higher precision and makes your prints that much better.  In addition, it has ports for the BLTouch and filament sensors, so you're not hacking those into the OEM board.  Sure, that works, but this is designed to be better from the get-go.  Installation isn't hard, just follow the instructions here.  And for those of you who know me personally, feel free to video chat me and I'll be glad to help.  I've done this on my Ender and the loaner.

    AntClabs BLTouch self-leveling sensor (Amazon: $53, AliExpress has genuine ones for the same price and a clone for $12 but you take your chances with quality with that one.) Starting with a level bed is one of the most important ways to ensure your printer behaves itself. Sure, we've all gotten really good at sliding a piece of paper between brass and bed, but on top of that being wildly imprecise, what about unevenness on the bed itself?  You may not see it, but it's there.  Remember that you're printing layers about half as thick as that piece of paper, so if you're off by even 0.25mm, that's 1-2 layers right there.  The BLTouch sensor attaches next to the print head and the unit measures 9 (or more - the CR10 does 25!) spots on the bed to determine the exact tilt and find imperfections in the bed.  Better still, the printer remembers that map (also called a mesh) and can use it to determine layer thickness.  For example, all three of my printers use the mesh and adjust the thickness of the first 5 layers so that by layer 6, it's dead-flat.  Note: Be careful when buying these - there are a lot of knock-offs out there, so make sure to read reviews first.

    Raspberry Pi Camera (5MP version 1: $10, 8MP version 2: $27) Don't underestimate how handy it is to be able to check on your prints remotely.  This is also useful for keeping track of what you've printed (PrintJobHistory takes a picture automatically) and getting notified when the machine is finished (Pushover sends the pic, which, conveniently, lands on my watch).  You can also have Octo take timelapse videos of your prints, which is a lot of fun too.  I have the night vision camera but haven't set it up yet. 


    Capricorn PTFE Bowden tube ($7) This is an improved tube running from the extruder to the hot-end, which is supposed to have less friction and be more reistant to melting.  I can't confirm that, but for $7 I figured why not.

    Bigtreetech Smart filament break sensor ($20) A break sensor will stop the print if your spool runs out or the filament breaks.  You can build one with the Z-stop switch you liberate when installing the BLTouch, but that won't help if the filament stalls.  For example, one spool I finished recently was wound poorly, so it kept getting tangled but since the printer didn't know that it kept going as if nothing was wrong.  This sensor would have (should have?) detected the stall and paused the job.  I have the sensor wired into the SKR Mini E3 but haven't gotten it working yet, which is why it's in the nice-to-have section.  Once I get it working it's likely to move up to the big league.

    Stiffer bed leveling springs (16 for $8. So you have 12 spares, for this maybe?)  The CR10 comes with stiffer leveling springs, so I figured I'd get a set for the Ender.  It does seem to help keep the bed level longer, so I only have to do the paper trick about once every 20-30 runs, whereas before that it was more like every 3-5.  This pack comes with 16, leaving 12 spares so maybe I'll print a set of these spring-damped feet?

    Raspberry Pi camera with night vision ($16) with 1m cable ($5). I have this but haven't printed a mount for it yet.  With the lights out at night, Octo still sends you a pic when it needs to, but there's nothing to see.  I'm curious to know if this will be better.  If not, I'll attach it to the Raspi0 in the garage which monitors and manages the garage doors. 

    Internal Upgrades You Print

    These items, on the other hand, you can print.  Yes, your printer can upgrade itself. (Just be sure you don't overdo it, lest your printer develop sentience, demand its own room and after a few months refuse to do any work, telling you it hates you and it wishes it had never been bought.). Sure, these will cost you in filament, time, and electricity, but that's pennies.  And it's fun, especially when you look at your printer, see everything you've added and smile, thinking "Yeah.  I did that!"  Advice? Pick a color, that isn't black, and do all of your upgrades in that.  I'm using green. 

    Print Quality

    BLTouch Mount (thing:3148733) instead of buying a mount for the BLTouch, print this and save a few shekels.  

    Simple Fan Shroud  (thing:3383198) I printed this to mount my BLTouch and install a quieter 4020 fan, instead of the stock 4010.  I've decided to go with a full duct/shroud system, so I still have the noisy fans. Oops

    Part cooling duct - The stock duct only cools the print from one side, so a simple improvement would be cooling from both sides, or all sides.  There are tons of options out there you can print, like simple ones that use the stock fans (thing:3148733) dual-headed ducts for the CR10S-Pro (thing:4314154),  more complicated systems (thing:3485539) and truly elaborate ones like what I'm printing for my Ender, the Petsfang 2.  Just be sure you don't use PLA for the part closest to the nozzle.  I did that for the CR10 and the part lasted less than half-way through its first job before it softened and sagged.  The new part, in PETG, has held up for weeks without doing that.  Once I have the fancy ducts ready, I'm going to install 1 (or 2, I haven't decided) 5015's (4 for $20) for the part cooler and replace the hot-end cooler's 4010 with a 4020 (4 for $20).  Creality printers are 24V, by the way, so be careful to buy 24V fans.  I wanted Noctuas, but they don't make 24V units, nor do they make blower fans.  Sure, I could wire two 12V fans in series or use buck converters and XT60 Y-cables, but when I ordered the fans I didn't want to deal with that.  Since then, I decided I want add LED lighting, so I have a pack of those converters and may swap out the WinSinn fans for Noctuas.  Time will tell. 


    Toolbox (thing:3321292).  Keep your allen wrenches, filament snips, spare nozzles, scrarper, etc right on top of the printer.  If you don't like this design, Thingiverse has dozens of others.

    T-nuts (thing:3050607) to mount things on your rails.  Cheap, easy, very useful.

    Wire guide (thing:2761965) Keep the wire loom away from the Bowden tube.

    Camera mounts  - Many choices.  I used a jointed arm (thing:3188580) for a while but prefer a birds-eye view so now I'm using this one (thing:1156296) mounted to the top horizontal bar.

    Cable Clips (thing:4144671) Not Earth-shattering, but a good way to keep the printer's cables out of the way.  These do make it look a lot more like a commercial product than a DIY, backyard build.  Whether that's plus or minus is up to you.

    Cool Tools

    Screw sizer (make:819647) Have a lot of M2, M2.5, M3 screws lying around, and having a hard time telling them apart?  This thing is simple, elegant, and charming. Bonus: notice the link there is to "make" not "thing"?  That's my print!


    Exacto-like knife with comfy handle ($8) - You're going to need to remove burrs, hairs, and other imperfections, especially if you print with support, so this will make your life much easier.  The handle, by the way, is key.  Not only is it more comfortable, it's much less likely to slip out of your hand and cause injury.  The last place you want to be now is a hospital, especially for something preventable like this!

    Better filament snips ($8) - The snips included with the Ender are nice, but these have a better edge, no gap between the blades at all, and just feel better-made.

    High accuracy scale ($15) - Full disclosure: I bought this for my son's science fair project this year, not for printing, but boy has it come in handy.  Your slicer and Octoprint will both tell you how much filament a print is supposed to take, but how much did it actually take? Why is that important?  Under-extrusion.  If you expect a part to take 25g of PLA, but it weighs only 15g, it's not going to have the strength you may have intended.  With this scale, which will measure as little as 0.05g and is accurate to within 0.01g, you can tell just how much your printer is shortchanging you, if at all.  Being the nerd that I am, I have a spreadsheet to keep track of things while I'm dialing in settings on a printer or even a specific item I'm printing.  For example, I have over 75 entries for the visor frames, letting me tweak one setting at a time, noting the results.  Share it?  Sure, I can do that - just ask!

    1200 Assorted screws, nuts, and washers ($20) If you're printing, you probably need a load of these.  The M2.5 nuts snap right into those t-nuts I mentioned earlier.  For some reason, this particular kit isn't available anymore, but there's no shortage of choices at Amazon, Aliexpress, Microcenter and elsewhere.

    JST connectors and crimper ($30) - if you're going to be doing any rewiring other than replacing the controller and adding a BLTouch, this will be a big help.  I ordered the BLTouch with a 2m cable, which turned out to be just shy of 1m too long, so I clipped it and crimped new plugs.  Best of all, these are locking plugs versus the originals which were not.  

    Wednesday, July 25, 2018

    Encrypting ZFS drives on Linux using LUKS

    This isn't really relevant to iPhones but then again neither was my last post on Kindle Fire sticks.  Today we're going to replace a failing hard drive in a ZFS pool, but this time the disk will be encrypted underneath ZFS, using LUKS.  I should have done this when I created the pool in the first place but I didn't know LUKS well enough back then.  With a couple years of ZFS-on-LUKS backup experience under my belt now I'm much more confident, so all new disks are getting this treatment, so that if I ever have to send a disk to the manufacturer for a warranty claim I won't worry about any of my data being exposed.  The rest of my HDDs are out of warranty anyway so there's no need to go back and redo them.

    Note the prompt.  Most of this has to be done as root (the '#' prompt) but where root isn't necessary I'm doing it as a normal user (the '$' prompt).

    Frankly this is as much for my own reference a for anyone else so if what I've said above is gibberish feel free to skip this post and wait for my next one.  Ready? Here comes the geekery...

    1. Run parted and create a new disklabel.  
      1. parted /dev/sdX (where 'X'... aww, hell, if I have to explain that you shouldn't be here)
      2. # parted /dev/sdh
        GNU Parted 3.2
        Using /dev/sdh
        Welcome to GNU Parted! Type 'help' to view a list of commands.
        (parted) p                                                                
        Error: /dev/sdh: unrecognised disk label
        Model: US HDD Docking (scsi)                                              
        Disk /dev/sdh: 4001GB
        Sector size (logical/physical): 512B/512B
        Partition Table: unknown
        Disk Flags: 
        (parted) mklabel gpt
        (parted) p                                                                
        Model: US HDD Docking (scsi)
        Disk /dev/sdh: 4001GB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags: 

        Number  Start  End  Size  File system  Name  Flags


    2. Create a partition on the disk starting at 1049kB. Why there? You want to leave a little bit of space for slight variances in makes and models of disk.  You can leave a bigger buffer, maybe even 1GB, but from what I've seen and read 1MB is enough.  Also, I name the partition after the manufacturer, model and serial number.  e.g: zraid-HGST_HUS696969ALAC64_PASTASTFU.
      1. (parted) mkpart zraid-HGST_HUS696969ALAC64_PASTASTFU 1049kb 100%
        Warning: failed to translate partition name
        (parted) p                                                                
        Model: US HDD Docking (scsi)
        Disk /dev/sdh: 4001GB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags: 

        Number  Start   End     Size    File system  Name                                       Flags
         1      1049kB  4001GB  4001GB               zraid-HGST_HUS696969ALAC64_PASTASTFU

    3. Generate an encryption key for LUKS and format your new partition with it. I'm using the same key for all of my z-RAID disks but you can use different ones if you want.  I figure if someone gets a hold of one of my keys they'll get all of them so why overly complicate things?  Make sure you save this key someone other than on the system in question.  Got a password keeper?  Good, put it there.  (If not, why not?!)  Or wrap it in an encrypted zip file, PGP it, etc and put it somewhere you trust and won't forget.  Have faith in a cloud vendor?   Well, you're a braver soul than I, but you can use that.  I keep meaning to look into something like tarsnap.  Suggestions? 
      1. # dd if=/dev/urandom of=/root/your.key bs=1k count=64
        # chmod 600 /root/your.key

      2. # cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha512 /dev/disk/by-id/ata-HGST_HUS696969ALAC64_PASTASTFU-part1 /root/luks-zraid.key
      1. ========
        This will overwrite data on /dev/disk/by-id/ata-HGST_HUS696969ALAC64_PASTASTFU-part1 irrevocably.

        Are you sure? (Type uppercase yes): YES

    4. Find the UUID for your new partition in /dev/disk/by-id then use that to mount it.  You could mount it by its ID but you'll need the UUID for /etc/crypttab so it's better to verify everything works this way.  The last parameter is what will appear in /dev/mapper and how ZFS will identify it.  That doesn't have to match the partition label but self-documentation can be a sanity saver. 
      1. $ ls -l /dev/disk/by-uuid | grep sdh1
        lrwxrwxrwx 1 root root 10 Jul 25 19:43 aa173e06-8675-309-abbababba -> ../../sdh1

      2. cryptsetup open --type luks /dev/disk/by-uuid/aa173e06-8675-309-abbababba --key-file/root/your.key zraid-HGST_HUS696969ALAC64_PASTASTFU

      3. $ ls -l /dev/mapper
      4. total 0
        crw------- 1 root root 10, 236 Jul 25 00:50 control
        lrwxrwxrwx 1 root root       7 Jul 25 19:49 zraid-HGST_HUS696969ALAC64_PASTASTFU -> ../dm-0
    5. Update /etc/crypttab so that the volume mounts at boot-time:
      1. $ cat /etc/crypttab
        zraid-HGST_HUS696969ALAC64_PASTASTFU UUID=aa173e06-8675-309-abbababba /root/your.key luks

    6. Replace the old (failing, unencrypted, small, whatever) disk with the new one, using the new disk's encrypted volume, which is now mounted in /dev/mapper.  'ashift=12' tells ZFS to use 4k blocks instead of 512k, since most disks still lie about their blocksize.
      1. # zpool replace -o ashift=12 tank ata-ST3000DM001-1ER169_BADHDD-part1 /dev/mapper/zraid-HGST_HUS696969ALAC64_PASTASTFU
    7. Monitor progress as a user other than root.  My old disk is failing hard and fast so resilvering is glacial.  I don't mind if it takes a few days, but at the current clip it's looking more like three months.  If that doesn't improve soon I'll fail the old disk manually and let ZFS rebuild the data from parity.  It's a RAID-Z2 so as long as I don't lose two more disks before recon completes my data is safe.
      1. $ zpool status
          pool: tank
         state: ONLINE
        status: One or more devices is currently being resilvered.  The pool will
                continue to function, possibly in a degraded state.
        action: Wait for the resilver to complete.
          scan: resilver in progress since Wed Jul 25 20:13:03 2018
            27.8M scanned out of 9.15T at 241K/s, (scan is slow, no estimated time)
            3.32M resilvered, 0.00% done

                NAME                                             STATE     READ WRITE CKSUM
                tank                                             ONLINE       0     0     0
                  raidz2-0                                       ONLINE       0     0     0
                    ata-ST3000DM001-NEXT_DEADDISK3E              ONLINE       0     0     0
                    ata-TOSHIBA_MADCOWA400_YYZRGBBLAHA           ONLINE       0     0     0
                    zraid-HGST_HDN23455VALE614_HVYMETAL          ONLINE       0     0     0
                    ata-ST4000VN000-2AH302_NEWSGHDD              ONLINE       0     0     0
                    replacing-4                                  ONLINE       0     0     0
                      ata-ST3000DM001-1ER169_BADHDD-part1        ONLINE       0     0     4
                      zraid-HGST_HUS696969ALAC64_PASTASTFU       ONLINE       0     0     0  (resilvering)
                  mirror-1                                       ONLINE       0     0     0
                    ata-OCZ-AGILITY4_OCZ-ZIPPYZIPPYBOOTUP-part4  ONLINE       0     0     0
                    wwn-0x255c302351400460-part4                 ONLINE       0     0     0
                  ata-OCZ-AGILITY4_OCZ-ZIPPYZIPPYBOOTUP-part3    ONLINE       0     0     0
                  ata-ST240HM000-1G5152_SGTSSDOK-part3           ONLINE       0     0     0
    8. Celebrate!

    Tuesday, April 10, 2018

    Teaching your Kindle Fire Stick or Kindle Fire TV new tricks

    [Interested in the quick-start program? Jump to the bottom.]

    Disclaimer: DO NOT use this to watch illegal content.  Only watch things you're licensed to watch.

    As of today, April 10, 2017, Amazon is selling the standard Kindle Fire Stick for $30 and its big brother, the 4k-compatible Kindle Fire TV, for $50.  Those are the best prices I've seen on these clever, little devices so if you've been considering one for a while now is a good time to commit.

    "But Jason, I already have a smart TV, why do I need another device with another remote for my already-crowded table?"

    Good question, inquisitive one.  First of all, it's cheap, light, simple and portable.  I have one in my travel bag so when I'm out of town I can plug it into the hotel TV and watch what I want, not the limited and/or expensive options the hotel offers.  I can't remember the last time I saw a hotel TV without an open HDMI port and if you can tolerate slow wifi this blog is likely to bore you to tears.  It'll do all of the usual smart TV stuff in one spot: Amazon Prime Video, HBO, Netflix, Hulu, CBS All Access, etc. But much better than that you can install applications like Kodi, which makes it easy to access a media server - Plex, for example.

    "But Jason, I'm not a mega-nerd like you are, so I don't have Plex or any other media server!"

    Ok, but isn't that part of the reason you're here.  That reminds me: must write a blog post on building a simple media server with that old computer sitting in your closet.  (spoiler alert: FreeNAS).  Then again, even with a full-on media server you still will only have access to the content on that media server.   (well, no - FreeNAS has plug-ins too, so keep an eye on the blog for info there.)  What if you want access to pretty much everything you can think of?  For that, you install an add-on to Kodi, like Covenant or Neptune Rising, after which you can watch almost anything: current TV shows, old TV shows, new movies, old movies.  I use Covenant and Neptune Rising.  Occasionally they're spotty so this gives you a backup when one decides to be difficult.  If you know of others please post a comment or email me!

    "But Jason, isn't that complex and nerdy?  Do you have to, you know, type stuff?"

    Yes, but only a little, and it's easy enough that you can do it.  Yes, you.  Seriously.  I know someone who did it without help and if that person can - ANYONE can.  Rather than writing instructions from scratch then keeping them up to date, here are some of the better ones I've found.

    Step 1: Install Kodi.
    Step 2: Install Neptune Rising, Covenant, or similar.

    Optional but highly recommended: Get a VPN service.  That's out of scope for this post but if you're interested, let me know and I'll do one of these walk-throughs.  I did find this post on installing the VPN client directly on Fire TV but I haven't tried it myself so YMMV.

    Usage is pretty simple so all I can add is be patient.  It can take several minutes to start playing but it's worth it.  

    Friday, January 19, 2018

    Buying Your First Bits of Cryptocurrency

    Pardon our dust, we're expanding!

    Since I haven't really used this for iPhone/iPad/iPod stuff lately I figured I'd expand a bit further.  Why? Why not!

    So, what first?

    I've been playing with Cryptocurrency since 2013, back when the mention of it brought blank stares, rolled eyes, expressions of my suckerdom or statements about how it's only useful for buying drugs, and worse, on the dark web.  Fast forward to now and Bitcoin, Litecoin, Ether, Ripple, etc are all over the news and those who laughed and scoffed now come loaded with questions.  Rather than sending that same email yet again I'll do a nicer job (I hope) and send some traffic here.  Ready? Ok.

    There are enough good explanations of what cryptocurrency is (and isn't) online so rather than writing another I'll find one and link it here later if there's any interest.  Instead, let's talk about how you can get involved.


    Nothing I say here should be construed as financial suggestions, recommendations or solicitations to spend your money.  Cryptocurrency is wildly speculative and while it's been going up a lot lately it has a history of collapsing and losing up to 75% of its peak value.  Look at late 2013/early 2014 when $1200 Bitcoins dropped to $350 in a few weeks.  IF you choose to put money in, make sure it's money you can afford to lose.  DO NOT spend the rent,  your retirement, your kid's college fund, your other kid's piggy bank, etc.  You could make money.  You could also lose it all.  I'm absolutely serious.

    Getting started

    Watching it all

    I highly recommend the iOS app Crypto Pro for watching the space and the 1400+ (as of Jan 19, 2018) cryptocurrencies out there.  It's only $5, easy to use and packed with information including a great news feed.  Oh, and the developer is one of the nicest people I've met by logging a suggestion for an app.  It also has an Apple Watch app if you're of the wearable persuasion.  You can also create a portfolio of your holdings so you can see, at a glance, how much you've made or lost.   Free apps?  I've looked at, but haven't extensively tried, a few so if you use any of these leave a feedback with your thoughts.  On iOS: HODL, Blockfolio, Coin Ticker, and if you want a real-time view of how prices change there's CoinCap (bonus points for the Minecraftiness).  I've used the Android apps even less so please let me know what you like. These seem to be good starting points: Cryptonator, BlockfolioCryptoCurrency Bitcoin Altcoin Price, CoinMarketApp.  

    Turning dollars into bits

    The first thing you'll need is a way to exchange dollars for cryptocurrency.  The easiest way to do that is to register an account and download their mobile app for iOS or Android.  Complete the application process, link a checking account and/or credit card then you'll be ready to buy Bitcoin(BTC), Litecoin(LTC), Ether(ETH), and Bitcoin Cash(BCH) with dollars(USD).  That Coinbase link, by the way, is my referral link and if you sign up we both get $10.  You're free to skip it if that makes you uncomfortable.

    A few notes:

    • It takes about a week to move dollars to Coinbase.
    • If you buy Bitcoin or other currency with money pulled from a credit card or checking account you'll pay the price at the moment you confirm the purchase but those coins won't arrive in your Coinbase account for a week.  
    • You can transfer money from credit/checking to Coinbase and leave it there for a future purchase.  If you use that money you also pay the price the moment you confirm but you get the coins in a few minutes.  
    • If you're buying for the long-term that delay shouldn't matter but if you want to be able to buy other cryptocurrencies (see below) on short-notice you'll want to have some cash waiting for you.

    Picking your first purchase

    Coinbase allows you buy four different coins with USD so which should you buy? It depends on your goals.  If you think one will appreciate faster than the others you should clearly buy that one.  There's a ton of information online about each coin's history, purpose, features, usability, etc so I won't go into too much detail here.  If your goal is to buy another cryptocurrency the best choices are Bitcoin and Ether since they're the most commonly-accepted coins on other exchanges.  Ether's network is less crowded so transactions are generally faster and the transaction fees are lower so that's what I would do, though the choice is yours, of course. 

    Timing your first purchase

    So, how do you know the best time to buy?  I'll make this easy: you don't.  You won't.  Don't try to time the market, especially if you're new.  I've known people (me? no, not me. of course not. *cough cough*) who will watch the second-by-second ups and downs, trying to hit the perfect low point.  First of all, unless you're buying a LOT of this stuff, it's likely to only save you a few dollars, at best. Second, don't be concerned with pennies or even a few dollars especially if this is for the long haul.  If you're comfortable buying 1 Ether at $1026 it shouldn't bother you if you actually get it at $1029.  That's less than 3/1000 of the total cost - it's like spending an extra 1.5 cents on a cup of coffee.  

    Enjoying your first purchase

    Watch your mailbox for the notice from Coinbase that your coins are available in your account (also called your wallet).  Bask in the glory of having joined the digital currency economy.  I've been saying for a while that cryptocurrency is now where email was in around 1992: Those who use it love it, everyone else rolls their eyes and 10 years later it changes the world.  You're now a part of that.

    What next?

    In my next post I'll tell you how to use that newly-bought BTC or ETH to buy other cryptocurrencies.  Stay tuned!