Neologism: Cigarette principle

Oct 22 2020

cigarette principle - noun phrase - The phenomenon in which, if you want something to happen sooner, you should do something that will immediately inconvenience you during the act of that something occurring.  Comes originally from the act of making a public transit bus arrive faster by lighting up a cigarette, which would of course cause you to ditch the smoke, dig out your bus pass or change, board and pay for the ride.  Generalizes effectively.

h/t: Mom

Embedded environment monitoring.

Oct 18 2020

Disclaimer: This post has lots of links to the Adafruit website.  There are no referral links, I received no consideration, I just buy parts from there and do cool things with them.

A couple of weeks months ago I did a writeup of a prototype environment monitoring device for my office built out of a Raspberry Pi Zero W and some off the shelf components.  In the time since I've found time here and there to work on the embedded version, which doesn't use a full computer system but a microcontroller with just enough functionality to drive a couple of sensors, get onto a wireless network, and run some custom software to do the heavy lifting.  Because I'm a lousy electrical engineer I once again went with development boards that I could reliably patch together with my limited electronics skills but program for readily.

I'm a software geek, what can I say?

Anyway, I once again went with Adafruit's AHT20 temperature and humidity sensor, which I already knew how to program with.  It's not perfect but it is well documented and stable.  After some research and head scratching, I decided to go with the Feather Huzzah development board, based upon the ESP8266 microcontroller.  It's a pretty nice little chip, with wifi built in and four megs of storage on board.  Unfortunately, Circuitpython is no longer supported on this board by Adafruit so I decided to give the port of Micropython to this board a try, and aside from a couple of drivers included in the default install which would be third party modules for Circuitpython, it was pretty much the same.  So that there would be a display on board to make it easier to work on I went with a fairly standard display, the 128x32 pixel OLED Featherwing.

Click for the rest of the article...

Setting up a mail relay server with Postfix, DKIM, and a little Nebula trickery.

Sep 22 2020

Given the proliferation of spam on just about every vaguely workable platform these days it seems sheer insanity to attempt to run your own mail server.  If it's out there, it's ripe for abuse in one way in another.  And yet, e-mail is still probably one of the best ways to get status reports from your machines every day (my SMTP bridge notwithstanding).  It is thus that the default configuration for mail servers these days defaults to "no way in hell will I relay a message for you," which is a net good for the the Internet as a whole, but by and large a huge pain in the ass if you actually want to set up a mail relay for some reason.  In my case, I wanted to set up Leandra (running in my rack at home) to relay outbound mail through another of my servers on the outside.  I further wanted to ensure that Leandra's outbound mail had the same kind of authentication and protection measures the rest of my machines have so that my servers wouldn't wind up on any spam blacklists and would be significantly difficult (because there is no 'impossible') to abuse.

The first thing I had to do was set up an A record in DNS for leandra.virtadpt.net pointing at the same IP address as the server I wanted to relay through.  If this were a sane and reasonable world I'd just set an alias with a CNAME record but it seems like nothing out there plays nicely with aliases anymore.  There is nothing that says at a single IP address can't have more than one hostname associated with it, so this isn't a big deal.

However, DKIM is kind of a big deal.  I don't fully understand it but I'll try explaining it as best I can, at least insofar as it applies to our use case.

Click for the rest of the article...

Neologism: Leaning Tower of Hangout

Sep 22 2020

Leaning Tower of Hangout - noun phrase - The covid-19 quarantine phenomenon in which one discovers a stack of hangouts on one's work calendar, all for the exact same time, all flagged as required, all scheduled while you were asleep the night before.

ref, Towers of Hanoi.

Wrestling with mental and physical health.

Sep 17 2020

This isn't easy for me to write because it involves my mental health.  So, if it's not your bag feel free to skip this post.

Helping my mom since her cancer diagnosis has left me in this peculiar state where I don't actually know what I'm feeling.  I call it "running on wires," as in, the silicon I'm connected to is running me, and the organics are off doing... something, maybe.  My therapist calls it alexithymia, and reading about it that's as good a word for it as any.

I've been fighting with clinical depression for most of my life, ever since my grandmother died in 1987 or 1988.ev (somewhen around fourth grade).  I've been in and out of various forms of therapy for most of my life, and while everything seems to help for a while it never lasts.  I've also been fighting with my body's weight (hang on... my weight) for about as long.  When I get depressed my diet goes to hell in a handbasket, and I know that I've put on some weight during the time I was in Pittsburgh.  I don't know how much because I haven't weighed myself, and I haven't wanted to weigh myself because I don't know how I'd react to seeing just how many pounds I've put on.

Under the cut, discussion of eating disorders.  Punch out if you want.

Click for the rest of the article...

Calculating entropy with Python.

Sep 13 2020

Fun fact: There is more than one kind of entropy out there.

If you've been through high school chemistry or physics, you might have learned about thermodynamic entropy, which is (roughly speaking) the amount of disorder in a closed system.  Alternatively, and a little more precisely, thermodynamic entropy can be defined as the heat in a volume of space equalizing throughout the volume.  But that's not the kind of entropy that I'm talking about.

Information theory has its own concept of entropy.  One way of explaining information theory is that it's the mathematical study of messages as they travel through a communications system (which you won't need to know anything about for the purposes of this article).  In the year 1948.ev Claude Shannon (the father of information theory) wrote a paper called A Mathematical Theory of Communication in which he proposed that the amount of raw information in a message could be thought of as the amount of uncertainty (or perhaps novelty) in a given volume of bits (a message) in a transmission.  So, Shannon entropy could be thought of as asking the question "How much meaningful information is present in this message?"  Flip a coin and there's only one bit - heads or tails, zero or one.  Look at a more complex message and it's not quite so simple.  However, let's consider a computational building block, if you will:

One bit has two states, zero or one, or 21 states.  Two bits have four possible states: 00, 01, 10, and 11, or 22 possible states.  n bits have 2n possible states, which means that they can store up to n bits of information.  Now we bring in logarithms, which we can think of in this case as "what number foo would we need in 2foo to represent the number of bits in a message?"

Click for the rest of the article...

Chemotherapy begins.

Sep 11 2020

Mom had her first round of chemotherapy last Tuesday.  Early that morning I drove her to the Hillman Cancer Center at UPMC, got her checked in, and had to leave as they took her back because, due to the pandemic and generally immunosuppressed state of the other patients in the office I posed a contamination risk.  I spent most of the day puttering around the house, fixing stuff up, cleaning, and getting a bit of dayjob work done after dropping her off.  Mom spent most of the day hooked up to one IV line or another.  Unsurprisingly, it took some time to get the actual procedure started: Mediports can be used for drawing blood samples as well as administering medications.  However, while it was possible to flush her mediport with saline the doctors weren't able to draw any blood samples through it and they couldn't proceed until they were able to.  As I understand the situation, it required three heparin flushes to un-fuck the catheter, which took roughly 90 minutes.

Mom's oncologist says that each run of chemo has to be compounded specifically to the patient's current blood stats, height, and weight, which is why vitals and blood samples need to be taken every time.  Seems like it's pretty tricky stuff to get right and it gets mixed up immediately prior to administration.  Thing is, if the blood sample takes a while to get, the compounding process takes a while, and and and... this is why cancer patients normally bring lunch and things to occupy their time while they're in the office hooked up.  Once they got things going, though, they started the process off with a prophylactic IV antibiotic (probably to minimize the risk of something already in her system getting any ideas while her immune system is suppressed), IV benadryl (because hypersensitivity to chemotheraputic drugs is a known problem), and an IV dose of an anti-nausea drug before the actual chemo drugs went in.

Click for the rest of the article...

A quick and easy way of downloading MP3s from Youtube.

Sep 08 2020

Let's say you find a particularly banging' track on Youtube that you'd like to save for posterity.. what's an easy way of grabbing just the audio so you can listen to it later?  Sure, you can go hunting for a sketchy website that'll download the video, strip out the audio, and give it to you in a download, but those come and go and you can never be sure you're getting what you want.  My personal favorite technique is to use youtube-dl: youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=EO2dPcvf1BQ

But I can never remember off the top of my head what combination of command line switches to use, I always have to go through youtube-dl's online help to find it.  Recently I realized that I could set a shell alias for this command and go about my usual business.  Oh, and document it so the next time I have to set up a box, I can just search my blog for what I did...  It was trivial to do, I just added the following to my ~/.bashrc file: alias mp3-dl='youtube-dl -x --audio-format mp3'

Now I just have to do this:

{09:28:27 @ Tue Sep 08}
[drwho @ windbringer mp3] () $ mp3-dl https://www.youtube.com/watch?v=EO2dPcvf1BQ
[youtube] EO2dPcvf1BQ: Downloading webpage
[youtube] EO2dPcvf1BQ: Downloading MPD manifest
[dashsegments] Total fragments: 12
[download] Destination: Warren Zevon - Real or Not w_Lyrics-EO2dPcvf1BQ.webm
[download] 100% of 1.64MiB in 00:01
[ffmpeg] Destination: Warren Zevon - Real or Not w_Lyrics-EO2dPcvf1BQ.mp3
Deleting original file Warren Zevon - Real or Not w_Lyrics-EO2dPcvf1BQ.webm (pass -k to keep)
{09:28:45 @ Tue Sep 08}
[drwho @ windbringer mp3] () $ 

Share and enjoy!

Another eventful couple of weeks.

Aug 30 2020

CW: Stuff about medicine, post-surgical care, and cancer.  Feel free to close the tab if you need to.

It's been a couple of weeks since my last update.  I was working on a different post in my spare time but I'm not entirely pleased with how it's turning out, plus I think it needs a lot more work, so I thought it'd be easier to write about the last week and change.  By "easier," I mean "easier to write," not "easier to handle."

A little over a week ago, on the 21st of August, I was killing time with mom rewatching Twin Peaks (she didn't know there was a third season so of course we had to rewatch the first two beforehand).  Nothing fancy, just the television and me hacking around a bit on a project.  Partway through the episode, around 2230 local time, she said in that quiet voice that in my family means that something is terribly wrong, that she was having trouble breathing and that I needed to call 911.  I'm sorry to say that I was expecting that something like this would occur so I kept my phone within arm's reach and had a go-bag packed and standing by, so it was the work of a few seconds to dial emergency services, give a situation report, request an ambulance, and get my stuff together.  There isn't much to say about the process of paramedics showing up, gathering data, loading my mom onto a stretcher, and heading to the hospital.  There wasn't any room in the ambulance, unfortunately, so I had to call in a favor from a neighbor to follow.

Click for the rest of the article...