Bits and Blocks

Reducing The Size Of Alpine Docker Images

1 minute read Published:

Why the heck is my alpine docker image so huge? That’s a tough question to answer, especially when you have no idea what’s taking up all of the space. This is a dirty little one-liner that yields a sorted list of all of the packages on your alpine image by size. It does this by Getting the complete list from apk info Iterating over the results to ask apk for its size Removing the blank lines Combining the size lines and the name lines Sorting by size apk info | while read a; do apk info -s $a; done | awk NF | sed 'Ns/\n/ /' | sort -k4 -n It may be ugly, but now I can make an informed decision about wether or not there are binaries that can be axed.

What Process Is Hogging My Port On Mac Os

1 minute read Published:

Address already in use Damn. Did I leave a server running somewhere? Sometimes you’re not sure where you left a server running, or where something is running you never knew about. I’m finally writing this down, as I always have to look it up. I found this solution in a StackOverflow post. Here’s how to get all of the processes by what port they’re using. sudo lsof -iTCP -sTCP:LISTEN -n -P As A Shell Function Looking at it, I realized I would never remember it, given how infrequently I need it.

Why Choose Vim

3 minute read Published:

TLDR Choosing a text editor is a very personal decision. You grow with your editor, as your editor grows with you. As I use my text editor more and more over the years, I’m constantly constantly learning new techniques for working more efficiently. Some of them stick, others are forgotten. I find that sequences and shortcuts that I most use stay. But just as importantly VIM accommodates my changing needs through configuration, plugin, or otherwise.

A Single Singleton in Ruby

4 minute read Published:

What is a singleton anyway? How do we use them to put large blocks of text in code.
The singleton design pattern I’m relatively new the the concept of the singleton, even though I’ve been programming for a number of years. I’ve run into several instances in which I new that this was exactly what I needed, but did not have a name for it. Here, I’m going to try to explain it to myself a year ago. There are a few questions I’ll try to address.

The Mysteries of the Ruby Heredoc

4 minute read Published:

A few tips on the ruby heredoc.
As of writing this, I’m running Ruby version 2.3.0. Not all of this, particularly the stripped heredoc, is available in plain ruby before 2.3.0. Heredoc Basics So, you need a string that’s longer than a line, and you’re sick of quotes and backslashes? And you might like to retain formatting? You want string interpolation too? Enter, heredoc. Here’s your basic, run of the mill, heredoc. You’ll notice we use the <<- operator, and our safe-word, which we will use to end the heredoc.