Covid-19 data in Python

What did New York geeks do this spring? Obsess over pandemic data.

The best data source for US data is Covid Tracking, the Atlantic Monthly project used by many hospitals and the US government. I was able to muck around in python and make this GIF.

Additional data for the state shapes is from and population data from (because I might want to break it down farther). After that it is just matplotlib, pandas & geopandas. I’m hoping to get the time to clean it up and put it up on github, but I’m happy to share it.

Update: Replaced the GIF with a version updated through 7/25, also using a rolling mean instead of raw numbers for the line graphs (smooth out spikes).

Setting up MySQL on a Raspberry Pi 3 B+

MySQL on ARM! It is not rocket surgery, but I’ve aggregated the different sources needed below with a brief description of how to get it installed.

ARM has continued it’s march to the data center, with most Enterprise Linux Distributions supporting 64-bit ARM in the last year and a growing list of ARM devices available from a growing list of chip makers. The devices themselves have gotten easier and more full-featured, and the best known of these is the Raspberry Pi 3 Model B+ .  Sporting 1GB of SDRAM, Ethernet, WiFi, HDMI and 4 USB ports, it’s more full-featured than any of my first few computers. 

As of version 8.0, MySQL is now available on ARM Linux. I’ll go through the basics of getting 8.0 installed on Oracle Linux on a Pi 3. You’ll need the Pi, a micro-SD card (fast and at least 16 GB, I’d recommend this one), a power adapter, a monitor with an HDMI cable, Ethernet, and a USB keyboard.

The alternative to the keyboard-and-monitor route is to ssh into the device once it is booted on ethernet – but you’ll need a way to find it’s IP address. It showed up on my router as “rpi3”.  Cases are nice, too, if you like that sort of thing.

To start you’ll want to get the latest Oracle Linux image for the Pi and put it on the SD card. It’s fairly straight-forward on most platforms, but I’d recommend the open source tool Etcher if you are not familiar with tools like the Linux/UNIX dd command. Once you have the image on the disk, insert it into the Pi, connect an HDMI device (TV or monitor) and a USB keyboard and power up the Pi by plugging it in (there is no power switch).

The default password for root is ‘oracle’ (which you’ll need to change on login). The first thing you will want to do is enable the MySQL repo  and update the system with the following commands:

yum install yum-utils
yum-config-manager --enable ol7_MySQL80
yum update

The last command is technically optional, but you really should update this new system (it will be a few minutes).

But the image is not large, and you have a lot of extra space on the card. To use all that space you’ll need a larger file partition than you got in the image, and then to grow the file system (btrfs by default) into that partition.

If you have never used fdisk, I’ll say only to be careful as it is easy to render your system unusable with it. Start by invoking it with the name of your device

fdisk /dev/mmcblk0

And Delete the last partition (command ‘d’, partition 4 – the default) and then create a New partition (command ‘n’) with the start point of the former partition and a size of “the rest of the disk”. Luckily most of these choices are the default prompts, but watch closely and remember to Print the current status (command ‘p’) and Write the new partition table (command ‘w’ – are you getting the idea?) when you are sure it is correct. You will get a warning, which you will ignore.

Restart the system to load your new partition table (and use the latest kernel you got from the above update):

shutdown now -r

After you log in again, grow your root file system to use all that new space:

btrfs filesystem resize max /

Finally, you are ready to install MySQL! Full installation instructions are available here, but in summary:

yum install mysql-community-server

Lastly, there is a known issue with MySQL not finding libc++, and a work around with

ln -s /opt/oracle/oracle-armtoolset-1/root/usr/lib64 /usr/lib64/gcc7

And start your server with systemd

systemctl start mysqld

That’s it!

You have a new MySQL 8.0 Server. If you didn’t know how to get the root password (grep ‘temporary password’ /var/log/mysqld.log) then you might now go peruse the aforementioned yum install page and perhaps the post-installation page in the official documentation.