Recent Posts

Links of the Day

less than 1 minute read

Links of the Day

less than 1 minute read

  • Jukebox of weirdness: Neural net to generate songs and sing the lyrics in the style of different musicians.
  • The Paradox of Source Code Secrecy: Quote: “In many cases of automated decisionmaking, algorithms – and the source code that informs them, are hidden from public view, even though they implicate core constitutional protections of due process, individualized justice and equal protection. However, because they are often protected as trade secrets, they can remain entirely free from public scrutiny.”
  • What to Do When AI Fails: Humans are acting differently because of the pandemic, but machine learning models have been trained on “normal” behavior. This article looks into what can be done when “garbage in, garbage out” leads to serious failures.
  • Nature By Numbers: Beautiful short film by Cristóbal Vila showing how the Fibonacci sequence occurs throughout nature.

Why Open Source?

6 minute read

So, I’ve got an idea in my head (well, where else would it be?) about comparing open source to magic. That still needs a while to brew in my wizard’s cauldron, so stay tuned or set a remembrall to come back and check some time in the future.

But wait, don’t go yet! One of the common ideas in open source is “release early, release often”, so I’m putting up my thoughts now, in advance of weaving them into a more magical narrative. This post may have bugs, annoyances, and a few swear words, but rest assured if it breaks you can keep both pieces. Oh, and feel free to cringe at the titles, taken from popular songs - because what’s more magical than music?

A Kind of Magic
How could I possibly resist throwing this in?

On with the show…

I Want It That Way

Humans love novelty. Some people want to try new foods, see new places, or find new ways to use their coffee maker. I’m all three of those. But being a geek from birth, I also love finding new ways to use (and sometimes break) my computer.

Broken PC
My PC, after one too many blue screens of death

On Windows I’m limited to changing my wallpaper or dragging my taskbar around. Or installing third-party graphical shells that don’t play nicely with the underlying system. On a Mac I’d have similar issues.

Litestep
Litestep Windows shell. I used this a lot back in the day

But on Linux I can get infinite diversity in infinite combinations. I can run the latest whiz-bang environment with rotating desktop cubes, or a barebones terminal with no graphics, or something that looks like it crawled out of the nineties. And I can mix and match bits of them as I see fit.

via Gfycat

My current setup is a stripped-down graphical interface that I mostly use for running a terminal emulator and web browser. It’s fully keyboard-driven, uses arcane key bindings (thank you Vim!), and is almost perfectly tailored for my needs. Going back to one of the standard operating systems makes me feel like typing with boxing gloves on.

My Gnome desktop
My current desktop, running Gnome and PaperWM

The Best Things in Life are Free

Back when I was a struggling student surviving on ramen and mince and cheese pies, I sure as Hell didn’t have any spare funds to throw at the latest Windows upgrade or (Heaven forbid) buying a Mac. I was stuck with what I had, or what I could download.

pie
What I ate every day at university in New Zealand. Except mine didn't look half as tasty. Thanks to itravelnz for the pic

Then I saw a computer magazine in a local shop. It was one of those ones with CD-ROMs stuck to the front, offering the latest and greatest demos, shareware, and full versions of out-of-date software. And in this case, something called Knoppix Linux. For about 5 quid, I could not only get a new operating system, but one that came preinstalled with an office suite, programming IDE, graphics editor, and more. And I could share it with my friends for free!

Gnome 1.0
Gnome 1.0: This was my first Linux desktop, back in the day

For a penniless student like myself, this was the only way I could’ve got my grubby little hands on all of these shiny goodies. Pirating really wasn’t an option on a 56k baud modem, and this was before torrenting was really a thing.

US Robotics Modem
The "good" old days. Thanks to monado for the pic

I’ve Got the Power

Open source software has the potential to continuously improve, and be driven by the needs of the users themselves. Sure, you could say that Windows 10 is an improvement on Vista, but there are definite downsides like ads clogging up your Start menu and your telemetry being reported back to Microsoft.

Windows 10 start menu
Where do you want to go today? Uh, not there...

You don’t like the direction in which your desktop environment is progressing? If enough users feel the same way, you can get together, fork it, and take it in a new direction. The MATE Desktop crew did just this with the Gnome codebase - they didn’t like the vision for Gnome 3.0, so took the 2.0 code and built their own version out of that. Just imagine trying to do the same thing with Windows or MacOS (admittedly, Gnome and MATE are desktop environments rather than full-blown operating systems like Windows, but that’s the beauty of it. Because it’s an open ecosystem, things are more modular. One system can have multiple desktop environments built in many different ways.)

MATE desktop
MATE Desktop

Who Wants to Live Forever?

What’s the most popular word processing software in the world? What happens if the owner goes out of business?

Wordstar

I’m not talking about Microsoft Word. I’m talking about WordStar, the dominant word processor of the 1980s. Thousands of users, including George R. R. Martin (from Game of Thrones fame) were left in the cold when it was abandoned. They’d invested time and effort into learning this system, and now what? Over time, operating systems deprecate old functions and old software “rots”. Now the only way to run that once powerful program is to install Linux and DOS emulator on top of that. Otherwise all of those .ws files you spent hours, days, and years on, are if not completely inaccessible, a total PITA to work with. It’s kind of ironic that now the only way to work with closed software like WordStar is via an open source system.

Now, how would that look in the modern day? Microsoft is way bigger than just Word, so let’s look at a smaller company that makes productivity tools: What would happen if Adobe went under?

  • You’d be stuck with your existing versions of Adobe software while the rest of the world marched on. After a while, operating systems will deprecate enough legacy code that old apps won’t run any more. I haven’t tried running Photoshop 1.0 on Windows 10, but I can’t imagine it would be easy
  • Even sooner than that, Adobe’s license activation servers would go down. Since Adobe Creative Suite is Software as a Service (SaaS), it relies on these servers to verify you’re a paying customer. No server means no verification means you’ll either have features restricted or you’ll be locked out completely
  • What happens then to all your PSD and AI files? You might be able to do something with them in Inkscape or GIMP, but there’s not 100% compatibility
  • If you want to keep moving forwards, you’ll need to learn a new piece of software. Goodbye muscle memory and interface familiarity!
Adobe dialog box
Illustrator? I barely knew 'er!

What happens if an open-source project goes under? If enough people care about it they can fork the code and keep it going themselves, just like MATE did.

You Learn

Isaac Newton
Fun fact: Isaac was also known for being a dick and sticking knitting needles into his own head

This is the quote that always springs to mind when I think of what open source has done for me personally. I got started with coding back in the bad old days of MS-DOS 5.0 and QBasic. I have fond memories of editing the physics in the Gorillas game to make the bananas fly where I wanted, and trying to build a Zork-like text adventure without initially realizing the sheer amount of object interactions I’d have to deal with.

Other kids got Donkey Kong. I had this monstrosity instead. via Gfycat

Gorillas came with Qbasic, and the code was available to view and edit. But really it (and BASIC itself) are just toys. I really got into programming with Python, and the open community has been so educational and helpful in building what I want, whether it's a terminal-based WeChat client, a tool to translate and summarize long PowerPoints from a professor, or a website to help hospitals get protective equipment more easily. Because I was building on open code bases (or in some cases, just open APIs and SDKs), I could see the magic for myself. The more popular programming languages and frameworks have extensive documentation and YouTube tutorials created by the community that helped me get running quickly, and by sharing the code myself, others helped me test it, fix bugs, and make it even better.

Around the World in 26 Cuisines

1 minute read

Over the course of the lockdown, I’ve been working, coding, sleeping, and binging Legends of Tomorrow. I’ve also been doing a lot of cooking, especially with my slow cooker.

With that in mind (and not much else to occupy us), my bubble buddies and I have decided upon a challenge. We’re going to cook a different dish each day (who am I kidding, whenever we feel like it), and each dish will be from a country starting with a different letter. Dish one will start with ‘A’, dish two with ‘B’, and so on.

Ground Rules

  • Try to find a dish from a country we know very little about. I’m a New Zealander, so I’d be more interested to try Argentina, Armenia, or Angola, rather than Australia for example.
  • Make sure it’s a dish where we can easily get the ingredients and equipment.
  • Since I love my slow cooker, make sure I can use that where possible. If not, I’ll just do whatever recipe sounds straightfoward.
  • One of my bubble buddies doesn’t eat red meat, so go with chicken or vegetarian options where possible.

Today, we’re kicking off with:

Angola: Slow Cooker Chicken Muamba

Recipe link

From Wikipedia:

Angola is a country on the west coast of Southern Africa. It is the seventh-largest country in Africa, bordered by Namibia to the south, the Democratic Republic of the Congo to the north, Zambia to the east, and the Atlantic Ocean to the west. Angola has an exclave province, the province of Cabinda that borders the Republic of the Congo and the Democratic Republic of the Congo. The capital and largest city of Angola is Luanda.

Using sudo with user dotfiles and aliases

less than 1 minute read

The Problem

I’m a terminal junkie, and a heavy user of Neovim. This leads to a couple of issues when I’m using sudo:

  • I’ve got nvim aliased to vim in my aliases file (which I source from both .bashrc and .zshrc, so I have consistency). Sudo doesn’t respect aliases by default, so opens up vanilla Vim
  • When I sudo nvim it brings up Neovim, but just uses the boring default settings (since I don’t have anything set up for the root user)

What I Want

What I want: I type sudo vim and it opens up Neovim with my user settings

The Solution

I’ve finally worked out a fix. In your .zshrc (or .bashrc or .whateverrc) file:

alias sudo='nocorrect sudo -E '

Now, when I type sudo vim foo.txt, it brings up Neovim with my own settings!

Breaking It Down

  • nocorrect - required by zsh for autocorrect to work with sudo
  • -E - tells sudo to respect the environment it’s being started in (i.e. the environment with my dotfiles)
  • The space at the end - passes aliases through to sudo

Notes

  • Maybe this only [[happened]] since I moved over to zsh from bash? I can’t remember to be honest

More Aliases

less than 1 minute read

Here are a few more of my shell aliases for anyone who’s interested. This is a follow-up to my shell clipboard aliases post.

Listing Files

I use exa instead of ls

alias ls='exa'
alias ll='ls -l'
alias la='ls -a'
alias l='ls'

Showing files

I use bat instead of cat or less. It provides syntax highlighting and better Markdown support

alias cat='bat'
alias less='bat'

Opening Files

Most files have a default opener. This command just opens them with that program.

alias o='xdg-open'

Grep colors

Adds syntax highlighting to grep

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

I should probably switch these over to ripgrep since it’s recursive and much faster.

Neovim

I’ve recently switched to Neovim instead of Vim for my editing needs.

alias vi='nvim'
alias vim='nvim'

Prettier Mount

Prettifies the mount output into columns

alias mount='mount | column -t'

Shell Clipboard Aliases

less than 1 minute read

I’ve just uploaded a few shell aliases to github to make it easier to work with X terminals and the clipboard. Enjoy!

Get Started with Ethereum Development with Cryptozombies

less than 1 minute read

Want to learn how to code smart contracts and Dapps with Ethereum? Try out Cryptozombies. It’s by far one of the best tutorials I’ve found for getting a basic feel for Solidity and how it differs from other languages. I’ve been through the whole thing myself, and had a great time building my unstoppable zombie horde along the way.

Disclaimer: I have no affiliation with Cryptozombies or CleverFlare - I just know good resources when I see them!

Dislaimer 2: I’m not sure if the release of Solidity 0.6.0 introduces any breaking changes compared to what you learn in the course. Even so, it’s still good for getting your bearings with the language (and building a fun deck of zombie cards)