# inspired by magicmirror

I've been really inspired by the MagicMirror project. The basic idea is getting a piece of mirror glass and putting a monitor and computer behind it, then having a status page show some pertinent information about the day (like weather, calendar, news, etc). So it looks like a regular mirror, but when you look closely, it shows the extra information.

I'd like to put one in the bedroom to replace our tall mirror. That'll be pretty cool, but it requires a bit of extra thought because our magicmirror setup would replace a tall and skinny mirror, so we'll probably just want a monitor behind the top part of the mirror. That will require some extra bracing to hold the monitor up in the frame. I'll need to think about that a while.

To hold me over in the mean time, and get a platform to play with the software, I ordered a Raspberry Pi 2 and small screen. With that, I'll be able to play with it on a small scale first. I was thinking about mounting it inbetween two cabinets in the bathroom, but just realized that might not work well with the steam from showers and soforth.

One thing I'd really like to see out of it would be bank & card balances. I guess I'm a little obsessive about that stuff, but it really would be nice to have it. This desire sent me down a big rabbit hole of trying to get OFX transactions downloaded. Of course, it seems nearly impossible. I was about to give up, but then stumbled across the fantastic mintapi python package.

# individual sealed ibuprofen & zyrtec

Today I made some individually sealed ibuprofen (Advil) and cetirizine (Zyrtec) packets:

I did it by cutting about a two inch strip of vacuum sealing bag, then doing several perpendicular seals far enough apart that I could pop a couple of pills in it.

Why bother? Mostly, I want to keep a few doses in my backpack / car, but don't want them turning into dust. (The softer coat on Kirkland seems especially problematic.) The next best idea is of course just buying the commercial version, but I don't really need 50 packets at a time. I'd prefer to keep more stock in the "more liquid" bottle form. Finally, waterproof can't hurt!

I meant to do double seals, so it'd be easy to separate the cells. I remembered on the first seal, but then I forgot to do this on all the others. So I had to very carefully slice down the middle of the seal. This probably wouldn't be sufficient for food storage, but it seems like it'll be fine for storing dry pills.

I cut small notches on each packet so I might have a chance at tearing them open without tools. I cut the bag almost exactly the same width, but the Ibuprofen bags wouldn't really vacuum because I put two Ibuprofen pills per slot. I had to settle for just sealing them.

It took about 10-12 minutes to do a row of 10 pills the second time I did it. I could probably get faster if I did it a bit more often. Cost calculations clearly reflect consumables only, and in particular don't reflect the cost of the vacuum sealer and other tools.

# first canning adventure: brandied pears

I've been wanting to get into canning for a while. It was finally time to take the plunge. I made brandied pears. One of the really striking things is how simple the ingredients list is:

• pears
• lemon juice
• sugar
• water
• brandy

Here's the setup just before I started:

Allison got me a pressure canner/cooker for Christmas:

It's huge! After I cooked the pears I packed them

and mixed the brandy into the syrup

and eventually got them into the cans, sealed and processed:

They are delicious! I think I'm going to try something next that requires the pressure canner's features, so I've got a few things on my list:

# recent projects - sous vide, hydroponic pump, and another table

I've been working on a few fun projects recently.

First: I built a temperature controller out of a crock pot and a cheap import temperature controller. It looks like this:

I've used it to cook eggs and steak. Both turned out great! Here's the only shots I got of the steak:

Next, I've put together another refinement of the hydroponic tomato setup we have in our living room. Also, just realized I haven't added the backposts about it yet. Allison and I started three tomato plants back in May:

They've grown into this:

That is a thirsty plant, so I rigged up a small electric pump to refill the bucket from a larger water container below:

Finally, I've been wanting some more desk space at home, but haven't wanted to get a full size desk replacement. I wanted to make something with the same construction as the coffee table project, but was wary of starting another hand-sawing project. So I got one of the Makita circular saws! It is impossible to overstate how much easier it made the project. The original coffee table took several days of work and hand sawing, while this time I had done most of the cutting in about a half hour!

Then I assembled the sides:

and put the top on, then put it in place:

I haven't stained it yet, but wanted to get a feel for fit and usefulness before that. One of the first things I realized was that it was really dark on the shelf. A long while back, Mom had given me some snazzy LED strip lights, so I gave them a try:

# build_json.sh

This might seem silly, but I've beeing playing with some json.sh scripts that build legitimate json bodies and are easily filled into a shell script variable as needed.

The basic driving idea was that there are lots of slick ways to pull data out of JSON(either by programming something with python's json or running a command line tool like jq or whatever), but not as many friendly ways to build some JSON out of a given token or whatever. Often, you have a list of identifiers and you need to build a bunch of JSON blobs from that list.

For example, say we have a file called things that contains

thing1
thing2
thing3
thing4


and we need to generate

{"value":"$THINGTOKEN"}  for each token in things. Then we can simply run a tiny shell command like Traviss-MacBook-Pro% while read token; do > echo$(newBuilder | set value $(quoted$token) | build)
> done < things
{"value":"thing1"}
{"value":"thing2"}
{"value":"thing3"}
{"value":"thing4"}


Easy as that! There's no waiting for heavy VMs to start up or anything like that, just run it.

# carputer brainstorming ideas

As much as I enjoy driving, radio almost always annoys me. There's a couple of particularly terrible stations and commercials around, but even the least objectionable of the pack really bother me. The focus did come with an auxiliary stereo input plug, which we have used extensively, but even that seems to have some shortcomings. In particular, one of the things I really miss about the radio approach is just that I don't really need to think that much about it -- it is just there while I'm driving around. Starting up spotify after I've started off isn't safe or prudent.

I started thinking about ways to improve this, and I think I finally came up with a workable idea.

The plan is to use a raspberry pi wired to the electrical system and stereo auxiliary input. I think the Pi should start up fast enough to start playing music shortly after starting the car, and with an SD card loaded with music should have plenty to not get bored with. I also realized that if I used some program like MPD to handle the music playing, I could probably remote control it from the iphone. That might require another hack or two (like a Linux-compatible USB/WiFi or bluetooth network adapter), but it would be pretty awesome to have phones in the car able to select the music. The Pi is cheap enough that I could probably just hide it under the front seat in the car and not be very worried about it getting too hot/etc, and I could power it out of the 12V phone charger that I already plug in to charge my phone.

The other cool part about this is that if I ever manage to get my radio installed in the car, I can potentiaally use the Pi (or some other computing unit) to send APRS packets or whatever.

Anyway, the actual setup:

1. Install Debian on the Pi, along with apt-get install mpd.
2. Copy a bunch of music onto the Pi SD card, either directly or by scp-ing files over.
3. Hook up the Pi to some speakers and troubleshoot the mpd installation.
4. Move the Pi to the car.
5. Ensure the wifi still works.

Next step will be running some machine learning analysis on the MPD play logs to see if I can build some really awesome playlists.

# car is paid off!

I finally sent the last check for my 2013 Ford Focus a couple of weeks ago, and finally got the title in the mail today. It also came with a "congratulations for paying off your car!" letter, which was a nice touch.

I opted to pay it off early, despite the (moderate) financial disadvantage it put me at. The loan was only 2.4%, so the cost of carrying the loan actually wasn't super significant. I had started paying the loan ahead of schedule during graduate school because I was worried about whether I would have the cashflow available to keep making payments during the time between graduate school and real paid work. Then when I did get a job, I just kept making the higher-than-required payments.

In any case, now that it is paid off, I get to enjoy a payment-free car with 20k miles on the clock until I'm ready for a new one!

# slide rules

Suppose you want to evaluate the multiplication problem $C = A\cdot B$. But you forgot your times tables, so you are stuck using your expedition watch or something. In fact, you can even make your own out of a couple of slips of paper, if you really need to.

First bit of background: One of the rules you probably learned and I definitely forgot was the rule of logs: $$C = A\cdot B \equiv \log C = \log(A\cdot B) = \log A + \log B$$ This ends up being useful for slide rules, because you can easily add distances together by putting two things next to eachother! So that is exactly what we do. We add the logarithms by putting things next to eachother.

The trick ends up being how we actually label the distances. We pick one convenient unit for the first interval, and that represents going from the value of 1 to the value 2. The key is then using that same interval, but having the value go from 2 to 4. And we continue this way until we have 1, 2, 4, 8, 16, 32, 64, 128 written down the split.

Suppose we call our two halves the left and right scales. Then here's the setup for actually doing a multiplication: Align the value 1 on the right scale with the value A. Then scan down to the value of B on the right scale, and read off the number we aligned with on the left scale. That is nothing other than C!

If you're wondering why it is not $\log C$, great question! It's because every time read a fixed distance, we are looking at the logarithmic scale, but when we read the value, we are taking log or exponential. It sounds weird, but it becomes pretty clear with a bit of practice.

Now, the next problem is: What if we want to multiply by 6, or something else that we haven't really labeled on our scale yet? The answer is that you end up estimating. One decent estimation once you have all the powers of two is just a linear interpolation. This is basically equivalent to

You can also use this to divide. If you want to evaluate $Z = X / Y$, just set X (on the fixed scale) next to Y (on the moving scale), and then read off Z (on the fixed scale) by finding the number adjacent to 1 (on the moving scale).

# debugging internet

My standard plan for debugging internet connections:

1. Can we reach stuff from some other device?

Usually, connection problems are something like "My iPad isn't working," which is caused by a flash of light in the sky, like when Swamp gas from a weather balloon gets trapped in a thermal pocket and reflects the light from Venus."

If it is a wifi problem:

2. Can we reach the router? Basically, this means running: : ping 192.168.1.1 except that sometimes it is some other IP address. In those cases, run something like: : windows> ipconfig /all : linux$route -nv : osx$ route -n get default | grep gateway

If this doesn't work, it means something is screwed up with the modem and/or router.

If it does, it means something else is wrong, so continue:

3. Can we reach the external modem IP address?

4. Can we reach another external IP address? Usually, this means running : ping 8.8.8.8 which should be a very reliable IP address.

If this doesn't work--i.e. anything other than output like: : PING 8.8.8.8 (8.8.8.8): 56 data bytes : 64 bytes from 8.8.8.8: icmp_seq=0 ttl=46 time=88.441 ms : ^C : --- 8.8.8.8 ping statistics --- : 1 packets transmitted, 1 packets received, 0.0% packet loss : round-trip min/avg/max/stddev = 88.441/88.441/88.441/0.000 ms (on OSX) indicates that your connection between the modem and the internet is degraded.

If that's not it, continue:

5. Can we reach another website by its URL?

If not, it probably means that DNS is degraded (i.e., the system that transforms puppies.com into the IP address 184.168.221.26 is broken somehow.

Usually, this means that your internet provider has DNS server downtime. A couple of options here are to set your primary and secondary DNS to Google's:

8.8.8.8
8.8.4.4


or, in a pinch, OpenDNS':

208.67.222.222
208.67.220.220


You might want to switch them back later.

# don't poll

A while ago, I wrote down a list of clever life rules in my day-to-day notebook. One of them was "don't poll". To say a bit more about it, don't spent time waiting for things to finish and checking them constantly.

A more concrete example: I find myself running terminal commands that take ~5 minutes, and then wasting ~5 minutes watching them. This is pretty stupid. So what I have started doing instead is run something like

$some_long_command [ ... scroll scroll scroll ... ] [ ... waiting for it to finish ... ] [ ... give up ... ] terminal-notifier -message "some_long_command done" [ ... go do something else ... ] Then, later I see a notification: Another one: If I set up a long running command and know when it should finish, I can also fire off something like at 1:05 << EOF terminal-notifier -message "hit 1:05 ETA for XXX being done" EOF which will fire off a message at 1:05 to remind me to check in on it. In fact, this is such a useful pattern that I wrote a small script around it: #!/bin/sh # remindat time message TIME=$1
shift
MESSAGE=$* at${TIME} <<EOF
terminal-notifier -message "\${MESSAGE}"
EOF

so now I can just run

remindat 1:05 hit 1:05 ETA for XXX being done


(Note: For the at command to work, I had to run:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist


after adding my username to /var/at/at.allow.)

Finally, iterm2 includes triggers that can run a command when it observes text matching a text. This is great!