Category: Blog

Firefox tricks: efficient QuantumBar usage

6 minute read    Published: 2021-09-07

The Firefox QuantumBar (formerly AwesomeBar, or just address bar) is surprisingly capable. There's a lot you can do with it to quickly navigate through your browser. It's one of the things which makes Firefox so comfy to me.

I like to be as quick as possible without leaving the keyboard. For this, I use scope characters, bookmark keywords, and DuckDuckGo bangs. In this article I'll go through these features and hope to show you something new, no add-ons required.

Elegant bash conditionals

5 minute read    Published: 2021-03-02

The if-statement is a very basic thing, not just in bash, but in all of programming. I see them used quite a lot in shell scripts, even though in many cases they can be replaced with something much more elegant.

In this rather short article, I'll show how control operators can be used instead. Many probably know about this, but don't realize how to use them nicely. This will help you write cleaner shell scripts in the future.

Here is what a simple if-statements looks like in bash:

if [ expression ]
then
    command
fi

# or
if [ expression ]; then command; fi

Ughh. Let's improve!

List & export your subreddits

2 minute read    Published: 2021-03-01

The last few years I've been wanting to export the list of subreddits I joined. It's fun to share with friends having a similar interest, as I've collected many gems throughout the years.

To achieve this I've set-up a simple script. It exports your subreddits to a plain text list.

Reconnect to broken tmux session

2 minute read    Published: 2021-02-28

Ever tried to attach to a running tmux session, only to find that that fails?

tmux attach
# no sessions
tmux ls
# error connecting to /tmp/tmux-1000/default (No such file or directory)

Even though you're sure tmux is running fine, it shows up as running in your task manager after all.

So, where are your precious tmux sessions?

Solving Advent of Code 2020 in under a second

25 minute read    Published: 2021-02-27
       ,--.-----.--.
       |--|-----|--|
       |--|     |--|
       |  |-----|  |
     __|--|     |--|__
    /  |  |-----|  |  \              mm    mmmm    mmm
   /   \__|-----|__/   \             ##   m"  "m m"   "
  /   ______---______   \/\         #  #  #    # #
 /   /               \   \/         #mm#  #    # #
{   /    _     _   _  \   }        #    #  #mm#   "mmm"
|  { /  | | . | | /|   }  |-,   
|  | \  |_| . |_| _|_  |  | |    mmmm   mmmm   mmmm   mmmm
|  {                   }  |-'   "   "# m"  "m "   "# m"  "m
{   \                 /   }         m" #  m #     m" #  m #
 \   `------___------'   /\       m"   #    #   m"   #    #
  \     __|-----|__     /\/     m#mmmm  #mm#  m#mmmm  #mm#
   \   /  |-----|  \   /
    \  |--|     |--|  /
     --|  |-----|  |--
       |--|     |--|
       |--|-----|--|
       `--'-----`--'

Advent of Code is a popular yearly programming competition. It's an Advent calendar of small programming puzzles for a variety of skill sets and levels that can be solved in any programming language you like.

Puzzles are released daily throughout December. More than 150k people take part in this event. The toughest battle to solve each puzzle as soon as possible to become the best on the global leaderboard.

In my timezone, puzzles are released at 6 o'clock in the morning. Since I'm a night owl, the biggest challenge for me here is to get up so early. I, therefore, set a different goal instead.

Stealing private keys from a secure file sharing service

9 minute read    Published: 2019-10-27

Note: in agreement with the company, I decided not to name them to prevent damaging their brand image. The company fixed the issue within an hour after notifying them, big kudos for that.

Some days ago an article was posted on a Dutch tech website, showing off a newly released service to securely request files from someone through the web.

As always, I'm super interested in the cryptographic implementation of such services to ensure they're secure. Even if for example, the company servers would be compromised. Sadly, their website didn't go deep into the technical details. It only noted some simple facts that local cryptography is used with a private key using RSA and AES to provide end-to-end encryption. The application is not open-source which would allow easy auditing, and no white paper is available.

Their website claims the system is secure, but everyone makes mistakes. So I decided to put it to the test. Let's see what I could break.

Spoiler alert: it didn't turn out so well...

Snippet: Correctly capitalize names in PHP

5 minute read    Published: 2019-07-17

When building websites with any kind of user registration, it's fascinating what people enter in name fields. no casing, Random CASING, a dozen spaces    between     words, or nospacingatall. Seeing this always irritates me, I'd fancy things to nice and be consistent.

It appears that correctly normalizing name capitalization is an unsolvable puzzle. There is no consistency in name casing, or for any kind of name formatting for that matter. See Falsehoods programmers believe about names.

I always wonder how big social networks handle this.

Okay, so this isn't solvable. But at least I could try to make it better. I came across this wonderful PHP snippet for name capitalization a while back, but it had a few shortages. It didn't correctly case with just a person's last name for instance (needed when storing first/last names separate). I love challenges like this and decided to improve, here is my take on it:

Dark mode toggle on your static website

8 minute read    Published: 2019-07-16

Developers like dark themes. When looking at a screen all day (or rather, night) long, a pale white background with black text is an eyesore. Many software engineers prefer to use a dark theme with lower contrast colors in their code editors, and many tools started shipping dark visuals as default in the last few years.

I fall into that group as well and have been using these themes for so long that I can't even recall when I joined the dark side. I started to like these dark themes a lot and find them more visually pleasing, appearing more... Professional. To reflect this, I wanted to give my website – this website – dark visuals as well.

This isn't always a success. On some screens or in some light conditions the dark theme can be difficult to read, and some just prefer a paper-like background color anyway. I decided to create a dark/light mode toggle to please everyone.

🌓 — Tap the moon icon, and see the magic happen.

Fix Windows 10 terminals, use a Linux terminal

12 minute read    Published: 2019-07-08

I feel handicapped in Windows terminals, here is why, and how I fixed it.

As a seasoned developer, I live in the terminal on Linux machines. Using a custom shell, vim as text/code editor, git through its CLI, dotfiles to sync settings across devices. Everything is customized to my likings and styled with a nice color scheme. All of it in a dark, text-based window on my screen.

Once you get used to your command-line tools, it's a serious joy to work with. It's a way to interface with your machine in a super-efficient and expressive manner. As you can probably imagine, it can be pretty frustrating when you don't have access to the tools you know and love.

I sometimes use a Windows machine, for work or for building Windows-supported software. Sadly, I feel pretty handicapped on this operating system, to be frank. I can't get comfortable (and I'm super OCD for that matter). The overall experience always appears to be subpar to what I'm used to.

Fresh & shiny website, hurray!

2 minute read    Published: 2019-07-03

My personal website had basically been unchanged, lacking content, collecting dust, since 2011 (!!!), and here we are, more than 8 years later.

Finally, I made some effort to revamp my personal website – something you obviously want to be proper looking – to scrap the previous. I put some work in building a custom template to properly personalize it, with a dark interface to reflect the stereotypical developer. It has some bold design choices, so it'll be exciting how it works out.

Surprise surprise, you're currently visiting the fresh and shiny new website. Or not so shiny after all, because it's dark.