Backing Up and Rotating MySQL Databases the Easy Way

By · Published · linux, bash, mysql

Here's a little quickie for you. Say you have a small MySQL server floating around your house that you want to have regular backups of. You do want regular backups right?

In my case, the biggest motivation was wanting a regular way to grab a recent MySQL dump of an internal tool I use at home to develop against. After poking around the Internet a bit, I was surprised that, other than mysqldump itself, there doesn't seem to be a simple tool out there that you can slam into a cronjob and let it do it's thing.

So, like any good hacker, I decided to brew my own. After all, when you have 256,428 different solutions, why not make solution 256,429? :)

Read More...

Securing static resources with cookies, nginx, and Lua

By · Published · nginx, lua

I've been working with one of my clients the last month on migrating his iron- based architecture to a cloud-based provider. In this transition, we are going from one or two physical servers to multiple cloud servers and separating out parts to better scale each individual service.

As part of this, we are moving a significant library of images and videos away from being served off the same web server as the application and to a server tuned to handle requests for these static assets. The problem is that a lot of these assets (the videos and full-size images) are for paying members only. We need a way to secure those resources across physical servers.

Read More...

Wallpaper Swapping with Hammerspoon

By · Published · hammerspoon, lua, mac, apple, osx

Hammerspoon is a pretty nifty tool. It's kind of difficult to explain what it does, but the best I can do is that it allows you to use Lua to script actions on your Mac and, crucially, respond to events.

For instance, I use Hammerspoon to lauch all my applications when I get to work and lay them out on the screen in the order that I like. I can do this because I was able to attach a location listener to work's location, and execute Lua code on arrival. The amount of things that you can do with this tool is pretty stunning. It's become an indespensible part of my macOS experience.

Read More...

That Time I Became A 76-Year-Old New Yorker

By · Published · security

Or, what happens when you send an email to the wrong place.

Note, for the time being, I have redacted the names of the company and doctor involved as I am attempting to follow through with a responsible disclosure process for this security issue.

I had something very strange happen to me today.

It all began with a random email to an address that I don't use much anymore, but still have in Mail. It's an email account I've had for over 13 years, so it still gets the occasional stray email. The subject read as follows:

Followed in quick succession by another one:

Wait, what?

Read More...

The Brilliance of Linux

By · Published · linux

I've been a Linux user for many, many years. Going all the way back to Red Hat 5.2, which I picked up to install on an ancient Packard Bell 486 in the late 90s. Since then there's always been at least one Linux machine in my dorm, apartment or house somewhere. At various times I've even run it for my desktop OS, although these days I use macOS for that.

For much of that time, Linux was the choice of hackers, but was definitely not a choice for everyday users and required a significant amount of technical knowledge to run. That's not true so much anymore, but growing in that environment I learned a lot about how computers and operating systems work.

Read More...

Using the DS3231 RTC (Real Time Clock) with Raspberry Pi

By · Published · raspberry pi, hardware

In my last post about building the pet feeders, I alluded to one of the limitations of the Raspberry Pi has: it lacks a real time clock. This is an understandable omission. They take up extra space and cost, are not needed for a lot of applications and can be pretty easily added if they are.

One of the limitations I found is that, if there is a power outage that lasts a significant amount of time - long enough for the UPS batteries that keep the wireless up go dead, for instance - that the Raspberry Pi's may "lose" track of time if they can't reconnect to wifi and, thus, sync up by NTP.

Read More...

Rob's Raspberry Pi Powered Pet Feeders

By · Published · python, raspberry pi, bootstrap, vuejs, javascript, diy

Or, how to massively over-engineer dumping cat food into a bowl.

As with many of my projects, it started with something that made me angry. In this case, it was this: The Petmate Le Bistro Pet Feeder.

Okay, let's back up a little bit. Back to about 8 or so years ago. We had a cat at the time, Pumpkin, who as objectively not a good cat. She was foul tempered on the best of days and very difficult to love. But she was my wife and I's first pet, so we did love her all the same.

She had a habit of wanting food precisely on time. And if it was late, she would raise all manner of noise until she was fed. Often this came at some ungodly early time in the morning. So I bought a Petmate Le Bistro Pet Feeder.

Read More...

Using Pipenv with Systemd

By · Published · python, systemd, pipenv

So I've been doing a bit of Python recently for a project I'm working on on a Raspberry Pi. There will be a longer blog post about that in the next few weeks. But one thing I ran up against was that I wanted to start my daemon, written in Python, using a systemd service on Raspbian.

Normally, you would just shove a script invocation into a systemd unit and call it good, but in my case I had made use of Pipenv, which is a bit like Bundler in the Ruby world and Composer in the PHP world, to manage my project's dependencies.

Read More...

The 2017 Total Solar Eclipse

By · Published · space, eclipses

Sometime in the mid 90s, I downloaded an astronomy program for my computer. I don't even remember what it was called. In poking around on it, I discovered that it could plot future total solar eclipses and that one would pass, from the resolution of the map, very close to where I then lived in eastern Tennessee. The date was August 21st, 2017.

Read More...