Spectacles

I despise most social media. Facebook is nothing but sponsored ads and obscure reminders, Snapchat is just weird filters over poorly-lit selfies, and Twitter is full of (brief :P) political rants.

For some reason, everyone seems to love it all. Everyone has their preferred social network. I’m often posting random tech thoughts on Twitter or reposting Steven Universe fan art on Tumblr. I was interested in Facebook in the earlier days, back when you never saw a sponsored post, and I briefly tried Instagram when everyone was obsessed with taking pictures of their food, but I’ve really never understood the appeal of Snapchat. It’s incredibly popular, but every time I try to get into it I just get annoyed with the bad UI and complete lack of interesting content. So when Snap, Inc. announced their new name and their first product, you’d think I had no interest.

Snap, Inc.’s Spectacles are amazing. They’re some of the best-designed reasonably-affordable new tech I’ve seen in a long time. The build quality of every part is fantastic, from the custom magnetic USB cable to the charging case. Every little bit of the hardware is designed to serve a purpose without getting in the way of the user.

Using them feels very natural. I’m not sure I’ll ever reach a point where I’m regularly wearing them, but when they are on, starting a recording is a simple button press away. There’s a light on the inside of the frames that indicates when the recording is active and when it’s getting close to ending, allowing you to press again to add another 10 seconds.

My goal with this is to get myself to use Snapchat more. So far I still hate the UI and don’t get the point of the network, but I love using Spectacles! They’re very convenient and flexible since you can just record whatever you’re looking at with no setup and without having to hold anything.

I’ve realized since getting them that my life is fairly boring to watch. I think they’ll help me do interesting things more often so I have a good reason to actually have them. I’ll likely go hiking or something quite a bit more just to have an excuse to use them, kind of like when I first got my DSLR.

Overall, Spectacles are awesome. If you’ve got a bit of cash and either live in NYC, get really lucky and find a Snapbot, or want to spend a bit extra to get one on eBay, I highly recommend getting a pair.

The Pizza Blog

Between regularly ordering take out pizza, baking frozen pizzas several nights a week, and often going to sit-down pizza restaurants, I eat quite a lot of pizza.

For no real reason other than that I like websites, pizza, and photography, I’ve started a blog about pizza! I give brief reviews and usually include a photo of most of the pizzas I eat. Check it out at alan.pizza. Yes I love that domain.

Apple

Technology is awesome. Sometimes we just design things in a stupid way that unnecessarily limits the use of an otherwise awesome product. Apple does that a lot lately.

iOS is amazing. It’s fast, it’s efficient, it has incredible user retention, it’s reasonably visually appealing (minus some obvious contrast issues), it’s secure… all good.

But what if you don’t want to use Safari? You can install Chrome, but it’s just a Safari WebView with Chrome’s sync. Same with Firefox. Up until recently, third-party apps couldn’t even use the full Safari engine, severely limiting JavaScript performance.

Maybe you want to download a file? That seems simple enough. Except you can’t. iOS doesn’t allow you to save anything other than images from websites without third-party applications that are limited in what files they support as well. Even if you do manage to download a file, good luck opening it.

My biggest issue with iOS is one most people will probably not have even noticed. Try unlocking your screen and seeing how long it takes before the device responds to any other user input. It’s about 2 seconds. You’re waiting for an animation that does nothing. Try pressing the Home button from an app. Notice that delay? That one’s more practical - it waits to see if you’re going to press it twice, to enter the multi-tasking view. Still, after using Android for a while, that second delay is annoyingly long. Android doesn’t need to wait when pressing the home button because button clicks are unambiguous. Rather than use one button for several actions, each does one specific thing.

Customizing iOS is basically impossible. Jailbreaking supposedly makes this easy, but that’s mostly a luck game. Apple patches jailbreak exploits like they’re the worst thing that could possibly happen to them, instead of just letting users choose to unlock their devices with a big warning like Android does. If you do get lucky enough to be running the right version of iOS when a jailbreak is released, you better not be interested in updating for the next year or so.

The new MacBook Pro is nice. It’s incredibly thin and lightweight. I’m mostly okay with removing USB type-A ports too. Type-C is the future and we may as well embrace it.

That Touch Bar though. It’s so pointless. 95% of it’s functionality is just a shortcut to functionality already available via a hotkey, only you can’t feel for it and it’s not in a consistent place between applications.

Weirdly, the Touch Bar feels cheaply implemented in person. On Apple’s renders, it looks beautifully designed and seems to sit flush with the keyboard. The actual LCD is visibly lower than the keys, and seems to be much lower quality than the main display, which makes it seem like an extra add-on rather than a well-integrated feature.

I also miss my SD card slot, and MagSafe, while proprietary, was really nice.

MySQL Backups

MySQL is pretty nice for a free, Open Source RDBMS. Before trying any kind of management, you should totally have a .my.cnf file in your ~. Put your username and password for localhost there, and then remove read permissions from everyone but yourself. This file specifies the default options to use with MySQL command line tools, making them much easier to work with, and avoiding having to repeatedly type in your password or accidentally letting it end up in a history file somewhere.

[client]
user=root
password=letmein

Flexible backups with mysqldump

The mysqldump tool is fairly straightforward, but you’re likely not using it to it’s full potential.

To make working with your export easier (making structure adjustments and such), it’s often useful to export the schema and data separately. A --no-data dump will include table schemas and view declarations, while a --no-create-info backup will only include table data.

mysqldump --no-data dbname | gzip > dbname-schema.sql.gz
mysqldump --no-create-info dbname | gzip > dbname.sql.gz

If you plan on changing your column ordering or adding columns from your schema file, your inserts in the data backup will no longer import correctly. To work around this, you can use the --complete-insert flag, which includes column names in the inserts, ensuring they restore properly as long as all the columns backed up are still present in the new table.

mysqldump --complete-insert --no-create-info dbname | gzip > dbname.sql.gz

Restoring views to a new server can fail if the view’s DEFINER is not a user on the new system. If you’re going to be importing the database on a different system with potentially different users, you can use grep to filter out the DEFINER rows, ensuring views import without errors.

mysqldump --no-data dbname | grep -v "50013 DEFINER" | gzip > dbname-schema.sql.gz

I pretty much always pipe mysqldump through gzip since there’s no good reason to keep an uncompressed export sitting around. Restoring gzipped backups is very simple to do in-place with the help of zcat.

zcat dbname-schema.sql.gz | mysql dbname
zcat dbname.sql.gz | mysql dbname

If you’ve got any stored procedures, triggers, or functions in your database, these will only be backed up if you use the --routines flag. I prefer to keep these in another file.

mysqldump --routines --no-data --no-create-info dbname | gzip > dbname-routines.sql.gz

If you’re using BLOB columns with unfiltered data, you may run into issues restoring backups of that data. To work around this, you can store those in hexadecimal which, while larger by default, shouldn’t take up too much more space once gzipped. Enable hex encoding with the --hex-blob flag.

mysqldump --hex-blob --no-create-info dbname | gzip > dbname.sql.gz

If your database consists entirely of InnoDB tables, you have the option of using a transactional backup, which ensures data integrity without requiring table-level locks! This can be enabled with the --single-transaction flag, but keep in mind any non-InnoDB tables will not be locked, and may be backed up inconsistently.

mysqldump --single-transaction --no-create-info dbname | gzip > dbname.sql.gz

Multi-threaded backups with mydumper

If all you’re looking for is a crazy-fast backup of a large database’s structure and data, you should be using the amazing mydumper tool, which uses a multi-threaded approach, backing up each table in a separate thread.

It’s fairly straightforward to use. Let’s do a gzip-compressed single-database backup.

mydumper -c -B dbname -d export_dir

Restoring a mydumper backup is quite simple

myloader -d export_dir

Mydumper also has powerful options like regex table name matching and row-count file splitting. Read the man page for details on everything mydumper and mysqldump can do.

Expand a live ext4 filesystem

So maybe you let your OS installer configure your partitions for you because you’re lazy like me. And maybe you realized it created a 16 GB swap partition on your tiny SSD. And maybe you wanted / to use that 16 GB.

Luckily, Linux is awesome.

root@box:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0  97.3G  0 part /
└─sda3   8:3    0  15.9G  0 part [SWAP]

/dev/sda2 is the partition we want to extend. We’ll use gdisk.

First, list the partitions to be sure we’re starting in the right place. Make a note of the start sector for the partition you want to extend, as we’ll be deleting it and creating a new one in it’s place.

root@box:~# gdisk /dev/sda
Command (? for help): p

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00  EFI System Partition
   2         1050624       190093083    97.3 GiB   8300  Linux filesystem
   3       190093084       234441614    15.9 GiB   8200  Linux swap

Next we’ll delete the swap and root partitions.

Command (? for help): d
Partition number (1-3): 3
Command (? for help): d
Partition number (1-2): 2

Create a new partition. Use the start sector from old partition as the first sector on the new one, leaving the default values for the last sector and partition type.

Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-234441614, default = 1050624) or {+-}size{KMGTP}: 1050624
Last sector (1050624-234441614, default = 234441614) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):

Print the new partition table to make sure everything looks right.

Command (? for help): p

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00  EFI System Partition
   2         1050624       234441614   111.3 GiB   8300  Linux filesystem

If it’s all good, write the new partition table to disk!

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y

Your new partition table is written, but the system won’t recognize it everywhere yet. We’ll partprobe to fix this.

partprobe

Now your new partition table should be live.

root@box:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 111.3G  0 part /

Finally, we’ll resize the filesystem to fill the new partition.

resize2fs /dev/sda2