I've decided to move all of my future technology-based articles to my developer-oriented blog, and I am shifting the focus of this blog to exclusively personal topics.
I created a blog called Between Two Commits with my friend Hamish Macpherson. It's been online for about a year, and we've been (slowly) building up content for it. We're still pretty open about what its niche or soul will be, but one thing that is certain is that it's developer-oriented. So far, we have articles about side projects, tutorials, and I've moved "The Hamish and Brandon Show" there, with the intention of relaunching it as the "Between Two Commits Podcast".
The name actually came from one of the episodes that we recorded. One of us said it, the other recognized it as a potential cool name for our site, which we already had in the works at the time. I really like it. All developers are technically between two commits (unless they haven't started!), and everything happens in that interval: coding, debugging, learning and training, and time off. It also metaphorically represents the two of us as we exchange during the podcast.
While still just a side project - and it may always be - we have lots that we want to do with B2C. We both have lists of articles we want to write for it, and topics for the podcast. I would like to have a "side project showcase" of some sort. We might also want to have guest writers.
All of this means that the purpose for which this blog has been created has run its course - in a very positive way. My goal was to have an outlet to share with the world - as a software developer - what I'm working on, what interests me, and what my journey is like. All this now has a more suitable home, which I also get to share with a fellow developer - hopefully more in the future.
So I am shifting the focus of this blog to be of a more personal nature. If, from time to time, I have a thought on a technical issue that is too small or otherwise inappropriate for B2C, I'll include it here instead. Aside from that, however, the posts here will be about anything except programming. Things that happen in my life, things that I've done, things that I hope to accomplish... the usual blog stuff. I'm often very guarded about my opinions, but if I share them, it will probably be here. My first personal blog was created in 2006. I've been an avid journal-keeper ever since, but the public-facing side of that has waned in recent years. I'm glad that this site gives me an opportunity to change that.
If you've ever read my blog and have been interested in the programming stuff, check out https://betweentwocommits.com. If you're here for updates on me, read on. In any case, thanks for stopping by.
Title photo by Georg Eiermann on...
]]>A new (maybe old) philosophy for personal computing, social media, and communication.
This is it. This is the idea that's been bouncing around in my head for years. It brings together my longtime interests of web development, networks, distributed systems, and self-hosted software. If, years from now, I become "known" for this idea (not as its inventor, since I am not, but as its chief promoter), then career-wise, I can die a happy man. If I could work on anything, this would probably be the project that I work on: A Server in Every Home.
What is "A Server in Every Home"? It's not a hardware or software product. I will not try to sell you anything by the end of this article (except, of course, the idea itself!). I do think specific hardware and software are involved in the solution, and they may end up as one or more products, but I'll get to that. "A Server in Every Home" is my (temporary) name for a philosophy - one that I believe our society will have to adopt in the years to come.
It relates - among other things - to social media and communications.
As we all know, right now, all social media and most of our internet communication is mediated by a few large companies, like facebook and google. People want to connect with other people and share things, and these companies perform this service for us. They do it free of charge - meaning you don't pay money - but there are other costs to you, and I believe these costs are too high. I don't want to take too long discussing them - each one can be and is the subject of numerous whole articles - so I'll summarize only a few.
One big one is content ownership. [1] Social media sites, in their terms of agreement, give themselves unlimited usage rights to anything you post on their sites. This is mainly to protect their legal behinds in our ridiculously litigious world, but it also means that you may one day see your own smiling face advertising facebook. Of course, they would never do that... right? No court on earth could stop them from using your content, or anyone else, for that matter. [1a] But I'm... 99% sure they would never do that. At any rate, is giving them the power to do it worth the use of their site? (And don't get me started on their proposed anti-revenge porn program. [2])
Another is privacy. [3] Privacy, tracking, data selling, metadata collection... There's only one reason that these companies do this: advertising. Advertising is an old and noble profession, but advertising in the internet age has gone crazy. There is so much data, and so much noise out there that everybody's head is spinning. The moment we started believing that all sorts of demographic, behaviourial, and historical data could be...
]]>In today's episode of The Hamish and Brandon Show, we talk about monitors and workflow tools, and generally about being adults.
Watch it here:
Or listen to it here:
Or you can download the mp3.
02:46 - Hamish got a new monitor
04:50 - Spectacle for Mac window management app
08:05 - DIVVY window management app
09:27 - xmonad tiling window manager
14:45 - iterm2 terminal emulator for Mac
15:06 - tmux terminal multiplexer
18:04 - software developers are just trying to one-up the programs they use
19:12 - there should be a limit to how many times you can get sick per season
20:46 - speaking loudly in video chats
23:14 - Brandon has a big baby and is looking for a bigger apartment
25:23 - apartment wish list
27:50 - comparing ourselves to our friends
30:18 - expensive apartment listings
34:08 - how much to spend on a house
36:21 - too many rental listings websites!
38:36 - buying a car
41:11 - paying cash vs financing
43:44 - how to scare your wife away
45:11 - Hamish's team's "on-site" in Lisbon
47:03 - pastéis de nata
]]>I've known my friend Hamish for many years, and we've had a common interest in technology and other such things. He was one of the first people to encourage me to get into programming in the first place, and he's been a mentor of sorts to me ever since.
Even though he has moved out West, and lives in Chilliwack, BC with his wife and kids, we've kept in touch. We've had semi-regular video chats where we catch up and talk about what's new. A couple weeks ago, he had the idea, "why don't we just record it?"
So... yeah.
We tried it out. We talked about things we found cool, and things that might be helpful. We were rather disorganized. We ended up talking for over two hours. As usual, we enjoyed our little chat. And you know what? There's a chance you might enjoy it too.
In the future, we'll cut it off at one hour, we'll be slightly more organized (only slightly), and we'll try to increase the quality of the sound.
If you do decide to take a peak, please let us know! And if you have comments and/or suggestions, please definitely let us know!
Watch it here:
Or listen to it here:
Or you can download the mp3.
16:30 - redux tutorial on egghead.io by Dan Abramov
21:30 - Wes Bos makes web development tutorials
23:20 - gatsby.js, server-side javascript framework
34:57 - Gogs, self-hosted git repository management system
40:00 - Fathom Analytics - non-google website analytics
41:37 - Paul Jarvis, author of Company of one
57:20 - MDX, markdown in react components
1:03:34 - blessed.js, library for building awesome CLI programs
1:20:25 - Hacktoberfest
1:29:58 - Mozilla Thimble Editor
1:31:37 - CodeSandbox
1:48:20 - Yarn Workspaces and Lerna, for managing large monorepos
1:33:30 - CodePen
1:34:30 - xkcd comic about "real programmers"
2:00:06 - Hamish's speaking gig, Cowork Chilliwack: What Do You Do Wednesday?
2:02:53 - RescueTime, computer time tracking app
2:09:00 - Brandon's screen recorder, inspired by Nick Winter's Telepath (demo on YouTube)
]]>I was listening to an interview of Peter Thiel, and he said something that caught my attention. The quote is, "If crypto is libertarian, then AI is communist." This little nugget of wisdom helped me piece together some stray thoughts I've had, between which I previously had not made any connections. Here's the segment; the relevant portion is rather short, but interesting. It starts at around 1 hour, 53 minutes, and goes on for four or five minutes:
Not only is he correct in that statement, but also in the secondary fact that crypto being "libertarian" is obvious, but AI being "communist" is not so widely said. Even before bitcoin existed, people have been waiting for the promise of decentralizing money and "cutting out" the big banks, and ultimately giving more power to the little guy. The concepts of cryptocurrency or e-cash, and then later, "smart contracts", was going to enable individuals to do more without involving the government, the established financial system, or the usual old gatekeepers. It's been long talked about. However, AI being more authoritarian is not an idea that's in the public mind. Part of the reason is that no one would really describe a new technology quite in those terms, but part of it is also because AI is different now than when it first started.
When I first heard about Artificial Intelligence, I envisioned a computer in a box that was capable of human-level thinking. Optionally, this man-made brain would be contained in an android body as depicted in science fiction - like Lieutenant Commander Data from Star Trek, or the droids from Star Wars. But whether inside a robot, or simply at an interactive TV screen in my home, each AI as I imagined it was a self-contained, simulated entity that could pass the Turing test. Just like in science fiction, it would have a personality (often including a bad sense of humour) and self-awareness. Sure, it might have direct access to the internet and/or a super-strong robot body, but it would otherwise be an individual among a large population of individuals.
However, I learned that it doesn't quite work that way. To illustrate, take the analogous example of human flight. For a very long time, we thought we could fly by mimicking birds - by having flapping wings that propelled the body forward while simultaneously creating lift. Although we learned many lessons in our failed attempts to copy birds, and although it is (now) technically possible to create a plane or a drone with flapping wings, our successful flying machines do something completely different. We studied the physics of air and gravity and motion, and created something that is different from birds, yet works for us.
In a sense, the opposite thing happened with AI. Originally, we tried to create really smart programs. We studied the rules of logic and information processing and mathematics, and built them into the code of our AIs. A piece of...
]]>The problem with having a multi-purpose, do-everything computer is that, just like the clutter on my desk, things in my computer start to accumulate. I use my laptop for work, for personal projects, for entertainment, for paperwork, and everything in between. Programs I've experimented with, temporary files, unnecessary configuration files, abandoned project folders, old photos... If there were a computer virus lurking on my hard drive, and actively wreaking havoc every time I connected to the internet, I might not even know about it. My virtual space gets just as cluttered as my physical space. My OCD tendencies may despair at my desk, but at least there is hope for my desktop.
When I was in college, the computers in the labs had some sort of "deep freeze" system that would reset the computer to a certain state every time we booted up. My classmates and I mostly found this annoying, since we couldn't install any programs we wanted to try, or save any files; and we were certain it had a few dozen keylogger programs on it. But this is kind of the idea that I'm going for: a way to "reset" my computer to a certain state. There are some key differences though that I need. First of all, I want to be able to keep my files. Obviously it shouldn't reset every time I restart the computer. And I want very fine-grained control over the whole process.
So I wrote a script.
Of course I wrote a script. That's what I know.
The OS I use most commonly is Linux Mint (which is based on Ubuntu), but it also works for lots of other Ubuntu distros. One could theoretically make a similar bootstrapping script for Windows or Mac OS, but you'd probably have to deal with license keys and other junk.
Before I describe how it works, it's important to note that this only works if you are making backups of your important files. In fact, you should always be making backups of all the files you don't want to lose. Actually, if you don't have a backup system in place right now that would give you peace of mind if you lost your computer in two hours, then stop reading this article, and spend the next ten to sixty minutes to get one.
So I begin by wiping my computer.
I have software that backs up my important files in real time, so it's okay.
I then install my OS of choice (usually this and wiping the computer are the same step). Then I get my bootstrapping script. Either I load it on a flash drive, or I download it from my personal git repository.
It's a bash script with a few other files (like dotfiles). The script is very straightforward, and is divided in six parts:
In my article about creating a script to help process my family finances, I mentioned a spreadsheet function called SUMPRODUCT. Let me explain a little more clearly how it works.
The SUMPRODUCT function is available in LibreOffice Calc and Microsoft Excel, as well as other programs like Google Sheets. As the name suggests, it returns the sum of the products between the arrays in the arguments.
Here's an example. Take the following table of values:
and the following formula:
=SUMPRODUCT( B1:B4, C1:C4 )
This is the equivalent of:
\(B1 \times C1 + B2 \times C2 + B3 \times C3 + B4 \times C4\)
or
\(1 \times 2 + 3 \times 4 + 5 \times 6 + 7 \times 8\)
which is 100.
This also works for arrays of more than a single column (or row):
=SUMPRODUCT( A1:B4, D1:E4 )
is
\(1 \times 3 + 2 \times 4 +5 \times 7 + 6 \times 8 +9 \times 11 + 10 \times 12 +13 \times 15 + 14 \times 16\)
which is 732.
And this works for multiple arrays as well, holding that each array has the same dimensions as all the others.
=SUMPRODUCT( A1:A4, B1:B4, C1:C4 )
Gives
\(1 \times 2 \times 3 + 4 \times 5 \times 6 + 7 \times 8 \times 9 + 10 \times 11 \times 12\)
which is 1950.
All this can be done with simpler formulae and intermediate data fields; but then again, all this can be done by hand on paper, or by a dozen carefully trained monkeys with sticks and stones. A cost-benefit analysis may be in order.
What's interesting about SUMPRODUCT, and what makes it useful for my situation, is the ability to apply conditions on the arrays. Suppose we have the following table, and we want to filter the results:
If you only want the sum of the products for all the apples, you can use this formula:
=SUMPRODUCT( A1:A4 = E2, B1:B4, C1:C4 )
What that first argument, A1:A4 = E2
, does is inspect each value in the array A1:A4
and checks if it's equal to the value in E2
(it also works if you put in "apple"
directly into the formula). This turns it into a boolean array, containing only true
or false
. In some spreadsheet programs, you have to convert the true
s and false
s into numbers, but in LibreOffice, it will automatically coerce true
into 1 and false
into 0 whenever the situation requires it.
The formula is then equivalent to:
\(1 \times 1 \times 2 + 1 \times 3 \times 4 + 0 \times 5 \times 6 + 1 \times 7 \times 8\)
which is 70.
The false
s become zeroes, which when multiplied by any value becomes zero, and cancels out that term. This also works with other mathematical checks, like <
or >
.
So here's how I used it. I have a table that looks like this (somewhat simplified):
Suppose I...
]]>I've been looking for a better way to keep track of my family finances, but - being the picky person I am - I've been having trouble finding one that meets all my needs. Obviously, my software developer mindset keeps telling me to make my own solution, but also, when it comes to my money and spending habits, I am even more privacy-obsessed than usual.
Usually, my wife and I look over our finances at least monthly. The idea is just to be able to track where and when my money is coming into my possession, where and when it is leaving, and then using that information to plan for the future (ie: budget). What we had been doing up until now was using a Google Sheet to track categories of spending. On the second Monday of every month, the two of us would sit down, and review our incomes and expenditures of the past month. We would categorize each transaction, and type in the amount in the appropriate cell. So, for example, if I ate out for lunch, we would type in "personal - brandon: $10.27". Because most categories would have more than one transaction in it, instead of a simple value, we would type in a calculation in the formula bar - "= 10.27 + 5.77 + 12.99" - and the spreadsheet gives the total.
Yes, all the numbers in the images are made up.
This process worked, in that it gave us a bird's-eye view of where our money was coming from, and where it was going, as well as whether we ended the month in the red or in the black. It being a spreadsheet, I could also customize it as we wanted. I could add or remove categories, add derived values (like sums or averages), and highlight certain data that I felt was important. There were some problems, however.
The biggest one was that, with this spreadsheet, we did not track individual transactions, only categories. This gave us a general view, but no detailed information. This also meant that we had to wait until a month was over (and at least a few days after that) before considering the expenditures for that month. This is because it's difficult to add to a dozen or so cells, each with their own little summation formula, days later. It was also near impossible to find errors (like typos), let alone fix them, without redoing the whole month.
There were also a lot of recurring transactions, such as rent and utilities, that we had to type in with all the rest. They have the same payee, and often, the same amount, every month. It was annoying to type it in over and over again. This is a prime candidate for automation.
Finally, although this system dealt with subtotals, and not details, I was still wary of feeding personal financial information into the Google machine (my love for them notwithstanding).
This is what...
]]>Back around the time that I was learning vim, my friend Simon from university introduced me to the concept of a "power user".
In general, a power user is someone that can get his or her way around a computer with great familiarity and ease. As someone who uses a computer very often - let's say... more than the average person - that part about "great familiarity and ease" appealed to me quite a bit. In order to get to that point, part of it requires getting used to certain workflows that seem weird at first, but are really efficient once you're more used to it. Part of it requires the right hardware and software. In the end, it mostly requires experimentation and practice.
Back to vim. vim is a text editing program. I use it mostly for writing code. It's a command-line program, meaning that it's completely text-based: no toolbars, no icons, no buttons. You can't even use the mouse with it. What really sets it apart, though, is the fact that it's a modal editor; meaning it has "modes". So when you open vim for the first time, you'll see that you can't immediately start typing your text. That's because by default, vim is in "command mode". Certain letters that you type are issuing commands to the editor. This could be as simple as deleting a character or a line, or switching to another mode. You need to switch to the "insert mode" before you can actually type your content. Incidentally, vim is also notoriously and hilariously difficult for beginners to exit.
Modes? No buttons? No mouse? Why go through all the hassle? Because, despite the steep learning curve, vim is really efficient to use. I can get far more done in the same amount of time in vim than I could using, for example, my previous default editor, notepad++. And one of the greatest parts of it is, I don't have to use the mouse.
That's right. As it turns out, the mouse is a remarkably inefficient computer input device for many situations. Take as a sample use case: moving the cursor of a text editor. With a mouse, you would first have to take your hand off the keyboard, and lay it on the mouse. Next, you would usually have to move the mouse a bit in order to find the pointer on the screen. If you have a nice editor, the pointer was probably hidden so that it is out of the way. Once it has reappeared and you see it dancing in a corner, you need to scroll the page, so that you can find the place where you want the cursor. This is done either with the scroll wheel (it's rare to find a mouse without one), or by clicking and dragging the scroll bar. The first option requires several repetitive motions of your finger on the wheel. The second option requires locating the scroll bar, moving the pointer there,...
]]>This is a simplified overview of how public-key cryptography works. It is meant to be a supplement to my other article, Asymmetric Encryption, which you might want to read first. What you are about to read involves some high-school-level math. If that's not your thing, feel free to skip this one!
Also note, I'm going to cover specifically how RSA encryption works. This system is slowly being replaced by others, like elliptic curve cryptography, but it's the oldest and still the most popular.
The principle reference for this explanation are my notes from my university discrete mathematics class. I have simplified it a bit, but not by much - turns out this is already pretty easy to get!
There are three mathematical concepts that you need in order to understand how and why this system works: exponentiation, modular arithmetic, and prime numbers.
Exponentiation is simple; it's just the number of times you multiply a number by itself. For example, 23 = 2 * 2 * 2 = 8.
Modular arithmetic is even simpler. It is when you take a number and count up to that number, but reset as you hit another number called the modulus. Loosely, it is the integer remainder after a division.
This is sometimes known as "clock counting", since clocks are a great example of this. In the case of a clock, our modulus is 12. If someone tells you that it's 14 o'clock (or 1400 hours), you know that they mean 2 o'clock, since you counted up to 12, then another 2 hours after that. If, for some strange reason, someone told you it was 26 o'clock, that would also mean 2 o'clock, since you counted up to 12 twice before finally counting another 2 hours.
In many programming languages, the modulo operation is written with a percent sign: 14 % 12 = 2. Mathematicians would say "14 is congruent with 2 mod 12", and write: 14 ≡ 2 (mod 12). Other examples include: 55 ≡ 11 (mod 22), 31 % 4 = 3, and 6 % 91 = 6.
Prime numbers are whole numbers that can only be evenly divided by one or itself. In other words, it has no other factors. Seven is a great prime number - seven is only evenly divisible by 1 and 7. You cannot divide it by 2, 3, 4, 5, or 6 without getting some remainder.
There are an infinite number of prime numbers. Because computers can calculate so quickly, the prime numbers that they use for encryption are very long (hundreds of digits).
The other important thing to know is that every integer has a unique prime factorization. This means that if I take two prime numbers and multiply them together, no other pair (or any combination) of prime numbers will multiply together to get that same product. Multiplying two prime numbers together - even very big ones - is easy and fast. Finding out...
]]>