I’m a Software Engineer. I graduated with an M.S.c. in Computer Science (Distinction). My research involved building WebSockets benchmark and visualization tools with Node.js and Python. I learn in the open by writing about my programming experiences with an aim to help beginners. My posts have over 100k reads and have been featured in DEV’s Top 7. I have a weekly newsletter. Also, I love plants 🌱
Premature optimization is the root of all evil. It’s also the root of this article.
When I was starting out, I never understood how to tackle ‘projects’. It was hard to understand the scope of a project from a glance, as well as the steps and considerations. I wanted to see behind the scenes. We all work differently but in this article I’m showing how I work when I get an idea-spark for something tiny. Come watch me scratch an itch.
We’re going to use Glitch as a free container platform to host our application. Better yet, it will have continuous deployment! Whenever we commit to our
masterbranch on GitHub, a secure webhook will be sent to our project, which will update, build, and restart itself.
Boyer–Moore majority vote algorithm — I love this algorithm because it’s amazing and approachable. I first saw it on a LeetCode discuss thread, and it blew everyone away. Some people were, like, irate. 169. Majority Element.
I read through the earliest README I could find. Written in 1975 by William J. Earl at the CS department of UIC. The text is a little dry but also surprisingly relatable, some 44 years later. “Due to a bug in the compiler, this function does not compile correctly”.
Something a lot of beginners struggle with is the concept of passing data between different programming languages. It’s far more simple to understand that a value exists in a variable which can be passed around from function to function. However, to go beyond the program’s edges we must serialized our data in some way. We’ll look at two ways that these two languages can communicate. AJAX requests via the new Fetch API, and piping between local processes.
Let’s learn about
Dead links and images and be frustrating for visitors. Manually checking for them can be even more frustrating! We’re going to build a bot that crawls a website for missing resources using just the Python standard library.
Usually, code golf means one of two things:
Dust off your ternary expressions, we’re going in.
We’re going to write a Reddit bot that listens for specific phrases and responds to comments that contain them. We’ll learn how the Reddit API can be interacted with in Python, while making a bot buddy of our own.
Travis CI offers free test builds for open source projects on GitHub. You’d be a fool not to take them up on their offer. Their email alerts have saved my projects many times before.
Notice how I said live cam and not live stream? It’s because we’ll be dealing with normal images. Go back about 15 years and this technology was exciting. Live weather cams and nature cams were deadly cool. Image-based live streams are also a little more robust when the connection between our Raspberry Pi and web server can be unreliable (e.g., WiFi).
After watching my flappy bird bounce and respond to my keystrokes, a fire was lit inside me. I just had completed a Unity tutorial at age 22. It had been a childhood dream to create software — to be an engineer. But it never really happened. So I decided to make it happen.
This blog is for my past self who worried about what they would be doing day-to-day after graduating.
A little over six months ago, I completed my thesis on WebSocket server performance. I’ve had a chance to use them in (global) production, and lemme tell you, this technology kicks ass!
Code review is the best part of the job
This Sunday, I worked on an API that creates a GitHub badge based off a project’s mood. Mood meaning the average time of day that the repository is worked on. I find that I work on different projects at different times of the day. In the morning, I skew towards back-end focused repositories. Maybe it’s the coffee? ☕
Let’s say we want to find every emoji as it’s posted to Reddit. First, we’ll define what an emoji is. The Unicode Consortium keeps their data lists avaliable. We’ll bring them in via a JSON file. The file has descriptions and other things we don’t need so we’ll clean the data a bit and store it in an efficient
Set. If we’re checking whether a character is or isn’t an emoji over 5k times a second we’ll need the
Zero refreshes required. This is Sudoku as you’ve never seen it. Away from the prying eyes of your co-workers and your boss. Powered by the dark arts of
window.location.hash. So powerful that just loading the page will cause your browser’s history to rue the day.
Order trackers are a great example of AJAX-ness: a web page updating itself fluidly in the background (even though customers will be spam refreshing!)
WebSockets run a large part of the web today. But which servers and frameworks are the best? Well, that depends on how you define best. If you’re after raw performance then the following post may be of interest to you. I will be going over some of my design notes for a small benchmark program I wrote in Python with asyncio and websockets.
I’m a big fan of all three problems and solutions today. I must say that these Easys are getting harder than their counterparts though. But I do often sort by acceptance rate high->low.
More algorithms today. Pretty efficient ones at that. All above 90% ranked on the first submission. I’m beginning to find a lot of patterns that can be applied to the different problems. Most of the Easy binary tree questions are guilty of this.
I felt like it was time to knock some of these tree questions out. I find that solving tree questions in Python leads to simple, elegant code.
I’m not too excited about any of my solutions today. They’re all fairly optimal but I suppose I would class them as ‘entry-level’ array problems. They didn’t require any three-dimensional thinking.
Today has been a good day.
Today we’re doing ‘Saturday Morning Coffee’ solutions – instead of ‘10pm Work Night’ solutions!
Watch out string problems: I’m coming for you.
I’m really learning a lot by reading the discussion boards after submitting each of my near-optimal solutions – especially, optimization. I’m also noticing holes in my toolset. E.g., bitwise – as we’ll see in just a second.
The three-a-day streak nearly ended today.
Three Mediums today. I looked at the Parentheses problem last night so it’s been bouncing around my head all day.
This blog is now live! A lot of these posts were just sitting on my computer but it’s now hooked up to GitHub Pages via Jekyll. GitHub Pages was very pleasant to use and extend.
I’ve been going through the problems roughly sorted by their acceptance rate: higher
->lower. Today, the difficulty is slowly creeping up. I’m looking forward to tackling some Mediums soon.
Title refers to my runtime rankings against other users not how long it took me to complete these. Ran into a couple of stubborn bugs, one of which was failing to read the question properly because I jumped ahead - doh.
Two out of three problems involve reversing today hence the title.
Continuing the Leetcode streak with more Python solving. I have a New Year’s Resolution related to Leetcode but I feel that to speak it is to jynx it.
After warming up (literally, I cycled home in frosty weather) I tackled some more Leetcode problems today.
This series involves tackling Leetcode problems and discussing my solutions with an aim to improve at problem solving and algorithmic analysis. For most problems, I will be aiming for the most optimal solution. I’ve recently been reviewing some academic content on algorithms and data-structures.