The Zen Of Python, One-Liners and Being Pythonic

Today, Carlton Gibson posted a wonderful short programming question:

I love little questions like this, and instantly came up with a solution. However, before I shared what I came up with, I took a quick look at the answers, and saw a bevy of very creative solutions.

None of these felt like an awesome solution for me. I’ve had some similar thoughts on some related matters, and it felt like time for a blog post.

Continue reading

Advent Of Code 2020 Reflection

I wasn’t able to do Advent of Code 2020 last year because I spent just about every night working on my book. However, one of my goals this year was to complete 107 stars on Advent Of Code. If I can pull that off, I’ll be just 50 stars shy of full completion (of course they are the hard ones left).

As such, I decided to tackle last year after I was done working on my book. I did the first 13 challenges over a week in March, the next 4 in May, and the remaining nine challenges this month. I figured this is a good chance to review my thoughts on each of the puzzles, and what I liked and didn’t like. If you’re interested, check out the repo here.

Overall Thoughts:

Someone mentioned to me they thought this was an easier year, and I agree (however, I’ve only finished one other year). The challenges seemed fairly straightforward, I looked forward to solving the problems. I love Advent of Code, so I was glad to complete these challenges. Not as many problems stuck out as memorable as past years, but it was overall enjoyable.

Continue reading

Tips and Tricks of the Month – August 2020

I played a lot with Rust this month, so wasn’t working in new technologies a whole lot; I don’t have a lot of tips and tricks. I’m not sure I found anything revolutionary in Rust that is worth stating just yet.


See Package Release Notes

In case you ever want to know what has changed in a package, you can do an apt changelog to see the release notes of a package

> apt changelog grub2
grub2 (2.04-1ubuntu26.2) focal; urgency=medium

  * debian/ Avoid calling grub-install on upgrade of the grub-pc
    package, since we cannot be certain that it will install to the correct
    disk and a grub-install failure will render the system unbootable.
    LP: #1889556.

 -- Steve Langasek <>  Thu, 30 Jul 2020 17:34:25 -0700

See SSH Key algorithms

I was debugging a SSH connection problem, and had to look at what keys a client supported. ssh -Q key will tell you all the algorithms that are supported for keys, and ssh -Q kex will tell you all the algorithms that are supported for key exchange.

Watch a command

If you want a command to run every so often, you can do it with the watch command. For instance, if you are tracking your temperature of your processors: watch sensors --farenheit

Tips and Tricks of the Month – June 2020

Back in May, I decided to write down my tips and tricks of the month. My hope is that people find them useful (or share even newer tricks for me), but at the very least, writing them down organizes my thoughts (and forces me to write a blog post more than once a year). So here’s what I got for June:


span:nth-child isn’t the nth span (6/22/20)

Shame on me again for not reading docs first.


    <span id='1'>
    <span id='2'>
    <p>Text </p>
    <span id='3'>
    <span id='4'>

If I have a CSS rule that specifies `span:nth-child(2n)` (or every 2nd one), it won’t give me the span with id 2 and 4, it will give me the span with 2 and 3! This is because nth-child refers to the sibling group, which is all the elements. From there it finds every second sibling, and then if that sibling is a span, does it apply the styling.

Continue reading

Tips and Tricks Of The Month – May 2020

So, inspired by a recent HackerNews post about somebody’s TIL’s for five years (found here), I want to start writing about things I learn about each month.  I feel like this format is easier to consume (I don’t think anyone will read a wall of text in a Git repo), but this will also help me organize my thoughts.  Writing things down helps me remember.

I’ll also highlight something that I didn’t necessarily learn, but re-discovered due to how helpful they are.


Boto3 uploading to S3 (5/12/20)

So as I was working on our website for Kudzera, LLC (which I’m statically hosting in AWS), I was trying to set up CI through GitHub Actions. Part of that was automatically uploading to S3. However, when I did, the webpage didn’t render (it instead prompted for download). Turns out, Boto3 uploads as a binary/octet-stream content type. With some use of mimetypes in Python, we can set the content type on upload

mimetype = mimetypes.guess_type(file_name)[0]
content_type = mimetype if mimetype is not None else "binary/octet-stream"

response = s3_client.upload_file(file_name,


Finding commits that are in one branch but not others (5/4/20)

git log old-branch ^new-branch

That one little ^ was a cool little feature I never knew about. I was trying to compare branches with a diff (one old and one new), as it turned out we had missed merging some commits in our devel branch when putting a feature back in an old release. A diff was useless, as there were legitimate things removed and added in the new branch.  This one command gave me everything I needed (you may want to pass –no-merges as well)

Running GitHub Actions only on a single branch

You may not want your GitHub action to happen on development branches, so if that’s the case you can do:

name: CI

      - master


Copying to clipboard (5/4/20)

xclip -selection clip-board <filename>

This is something I knew about, but never used. I copy my SSH key out to a GUI when launching VMs in a cloud all the time, and always hated having to do it.  Now I have a convenient alias to the command above.


Checking if an Element is in Pandas Series (5/20/20)

So doing a quick pandas script for some data analysis had me encounter a strange behavior. I was using pandas.Series and I wanted to check to see if there was an element inside that series. Thinking that a pandas.Series was a subtype (semantically speaking) of a list, but it turns out that if you do element in series , it just checks the index, not necessarily the values. Instead you should be doing element in series.values.


Beware the Pip Cache (5/29/20)

I ran into an issue with tox the other day, where an import of a library in my unit tests ran into an error finding No biggie, I had upgraded my OS since last time I worked on this package. So I cleared the .tox directory and let it pull things down. Same problem.

My system python and my pyenv python did not show the problem, so I know that it wasn’t an OS problem (I had installed, and those python’s were using it correctly). So what was happening?

My package had cffi pinned to an older version. My system python and pyenv were using a newer version of cffi. When tox tried to pull cffi, it was hitting the pip cache (and not actually downloading and recompiling the cffi wheel.), which meant it was grabbing an older pre-compiled incompatible version.

Web Development Tools

Searching through network logs in Firefox Web Console (5/8/20)

In Firefox (and I’m sure others), when you are doing network logging, you can search through all the traffic right in the web browser. Just click the search icon and type in your criteria – it’s way easier to filter network requests than saving out traffic and searching in something like WireSharkScreenshot from 2020-05-08 16-32-14

My Thoughts On WebAssembly

Just this past week, I was happy to announce that I finally completed something I’d been working on since November of last year – A WebAssembly Video Course. It was challenging for sure – I had played around with WebAssembly, but this was the first time that I was building a course from scratch and then recording it. You learn so much about a technology by teaching it, and I got to explore new depths of WebAssembly throughout this course. I’d like to share some of my thoughts of the WebAssembly/C++ ecosystem.

Continue reading

Changing Jobs When You’re a Senior Engineer

It’s been about half a year since I wrote my last post, and I wanted to reflect back on some of the goals I had set for myself.  In a nutshell, I wanted to 1) Grow HSV tech community, 2) learn some cloud technologies, 3) build something, and 4) read more theoretical books.

So halfway through the year, I feel like the HSV tech community has been growing, and is still going strong.  I still have a surprise coming, so stay tuned.  But what has derailed most of my other goals is that in April, I started a new job: Software Engineer at Canonical!

I’m working on the CPC team which focuses on public and private cloud deployments.  I mostly do Python library work and Jenkins pipelines to transform Ubuntu images to their suitable cloud images.  It’s been great, because 1) I can work in Python and 2) I am getting to learn about a lot of cloud technologies along the way.

But, this is only my third ever job.  The first time I moved jobs, I had 3 years of experience; now I have 12.  I feel like there is a lot of advice out there for when you are new and swapping jobs, but not so much when you’re a senior engineer.  Here are some tips I’ve discovered in the three months of working there.

Continue reading

AoC recap and Looking towards 2019

So for the first time ever, I have finished Advent Of Code.

 The Highs

  • Man it felt good to complete it AoC for once.  Finishing that last challenge, watching the animations, and reading the final piece of the story gave me such a feeling of accomplishment, that I just had to step back from my computer and grin.
  • There were some really diverse challenges that I had fun working through.  Recursive solutions, mapping 3d space, transpiling custom assembly, I definitely had my work cut out for me.
  • I got to learn way more than I thought I was going to in Python.  I knew itertools was awesome, but I got to learn some new things (accumulate, chain.from_iterable).  I also got to play with Counter for the first time.  And I got to play with mypy, which gives you type annotations.

 The Lows

  • Not everything was hunky dory.  For instance, Day 15. Day 15 took me days to do.  There were some very specific edge cases that I had to work out.
  • Day 17 was tricky too, but I ended up liking that one, but it took a little bit to figure out as well.
  • Day 23.  Oh Day 23.  I almost quit due to day 23.  I had an idea, but I knew it wasn’t mathematically sound.  I didn’t understand any of the things they were saying on reddit for this problem.  Eventually I figured out how to make my solution work with the math, but it was rough.

Continue reading

Advent of Code 2018 Week 1: Recap

So I’ve decided to do Advent of Code this year again (no surprise there), but this time, I’m encouraging everyone in to join me as well.

I’ve completed 8 challenges, and thought it was time for a recap.  I plan on breaking down solutions day by day, and then ending with some lessons learned that might help others.  I compete each night with ugly hacked together code, then work on refactoring it the next day.  What I share is the refactored version (Don’t think I spit something like this out in just an hour).  You can find all my code on my GitHub

So let’s get started.

Continue reading