Speeding up TimeMachine backups

TimeMachine is an incredibly smooth backup solution for Mac OS, but it can be a little slow, especially for initial backups or incremental backups that have a large amount of changes (such as a VM image being added to your filesystem or the typical I/O killer, many small files). I recently performed a TimeMachine backup to a brand new 1TB...

CURLing to a UNIX socket

In deployed environments, I often come across two Ruby application servers - Unicorn, and Puma. These servers are usually configured to listen on a UNIX socket file, usually located in the tmp/sockets directory of a Capistrano install, e.g. /home/deploy/appname/shared/tmp/sockets/appname.sock. It’s quite often useful to be able to connect to a UNIX socket to see if the application server is behaving...

tmux system clipboard copy & paste on Mac OS

I have recently begun using tmux as part of my everyday development process. It’s going great, but as somebody who uses a mixture of Mac OS applications like VS Code as well as terminal applications like git, vim, tail, cat, etc., the lack of system clipboard integration has really been hurting. I went out and did some research into how...

Pending block examples with RSpec

I have known about the different ways of marking tests as pending in RSpec for some time. When working on a feature for which there are already tests (e.g. cloning a similar feature where shared examples or a common starting point for tests can be used), it can be extremely convenient to temporarily mark as test as pending like so:...

https://v.redd.it video URLs

A couple of years ago, Reddit added support for video and gif hosting - basically in response to competition from Imgur and Giphy taking visitors offsite. This service works well, but they have been to some trouble to obfuscate things and make it a little hard to get to the raw video file - I guess to prevent hotlinking to...

Prevent unnecessary slowdown in IRB sessions with slow method calls

One of the convenient things that any interactive Ruby sesion (IRB) does for you is to inspect the return value of the statement it has just evaluated. This is normally great, but if you have something that takes a LONG time to evaluate and you don’t actually care about the result, it can cause the session to block completely unnecessarily....

Trip Report: Days Bay Main Ridge, Wellington

Start time: 11:20am from Days Bay Pavillion Finish time: ~ 2:30pm at Cheviot Bay Road + 15 minutes to cycle back to Days Bay Time: approximately 3 hours with a few breathers and a 15 minute stop for lunch An unexpected change in our weekend plans last weekend (mostly a sense of laziness that persisted all through Saturday) let us...

Entering a REPL from a PDB Python debugger

Something I have grown accustomed to when debugging Ruby code is the ability to jump into an irb session right from a breakpoint. With byebug this pretty much happens immediately. With pry, running irb will have the desired effect. When I started getting to the point where I needed to debug Python code I was writing, I almost immediately had...

Mocking Python requests library

One of the toughest part of writing tests is how to go about handling dependencies on external dependencies. Aside from databases, probably the most common type of external dependency is a network request - usually HTTP (or HTTPS). requests is a very, very popular library for performing HTTP requests in Python. It’s popular because of its easy to use API...

Aliasing Django model property

Not a super common occurrence, but exposing a Django model property under an alternative name is occasionally useful. I have used it before to assist in polymorphism, where several very similar models needed to have the same attribute. Given a Django model like: from django.db import models class Widget(models.Model): email = models.CharField(max_length=254) We can naievy try and alias the attribute...