Source As PDF

Projects

Things I am working on and things I have worked on

  • Patrick M. Elsen
  • Updated 2021-02-17

Every computer scientist likes to showcase what he has worked on, and I am no different. This is some of the projects that I have either worked on in an open-source fashion, or that I am allowed to talk about.

Passgen

Regular expressions, or regexes, are quite commonly known. They are strings in the form of, for example, /[a-z0-9]@(google|icloud).com/ that are commonly used for string validation (the notoriously difficult case being validating email addresses) or searching of documents or code1.

Coming up with useful passwords is notoriously hard. There are different suggestions and ideas for coming up with good passwords, but websites have requirements. What if you could write a regular expression, and a tool that would randomly pick a string such that it fits your regular expression?

That is exactly what passgen is. The idea is that you specify your password as a regex-like string, and it will generate a password for you correspondingly.

$ passgen '([a-z0-9]{6}-){2}[a-z0-9]{6}'
4fil1t-ibtdaf-r943pa

The repository is available at xfbs/passgen. There is also documentation available, as well as code coverage and other metrics.

FSDoc

Filesystems have always interested me, somehow. I know how Linux has those UNIX permissions, but how do Access Control Lists2 work there? What are extended attributes3? How are Alternate File Streams4 used on macOS, and why are they there in the first place?

In this project, I went for a deep dive into filesystems, looking at some of their features on both Linux and macOS. I implemented some common utilities in C, to learn about how the syscalls that we use to manipulate filesystems work. The repository is available at xfbs/fsdoc, and my 40-page report on what I have learned is published here: fsdoc.pdf.

Challenges

I really like challenging programming puzzles. They do a really good job of teaching me how important good programming craftsmanship is, and what patterns I can learn and reuse again and again. Usually, they are phrased in a way that the obvious, easy solution is far too inefficient to work, and it takes a bit of thinking and problem-solving to find one that does work.

The first challenge platform that I found was Project Euler, which is still one of my favorite ones. They focus on mathematical challenges, which is good because it means that I not only get to learn about programming, but I also get to learn about mathematics, which I otherwise might not encounter so often.

I have two repositories dedicated to solutions for these, one is xfbs/euler, where I have solutions written in Ruby, OCaml, C, C++, Crystal, and the other one is xfbs/euler.rs, where I have solutions written in Rust.

Another platform that I seem to like quite a bit is Kattis.

Apple Open Source

Apple uses a lot of open source software, and as part of that, they also publish a lot of it. However, not all of that is easily accessible, the main method of distribution that they use is tarballs at opensource.apple.com. Since Apple products are quite well-liked in the programmer community, I figured that it would be good to enable easier access to some of this code.

As part of that project, I wrote a script that will find and download all of the open source releases from Apple’s website, unpack them, and retroactively turn them into a Git5 repository. These repositories are published at github.com/appleopen. For example, the XNU kernel, which powers macOS and iPhones is available at appleopen/xnu.

Audio Mixer

I quite enjoy learning about and building electronics in my spare time. The audio mixer project is a project of mine where I wanted to address an issue I have, which is that I have too many devices (desktop, laptop, phone) on my desk but my speaker only has a single input. I designed, prototyped and manufactured a PCB for this, and I documented the project. The repository is available at xfbs/audio-mixer, along with a detailed writeup, schematics, design files and reference papers.

Assorted

Contributions

Part of being a good online citizen is giving back to the open source community. Everyone uses open source software daily, whether we like it or not – the phones we use, the browsers we use, so many essential things are based on the idea of sharing knowledge and code with others. I have made a few contributions to open source software myself, which I outline here.


  1. Ripgrep is a tool written in Rust that allows you to search an entire folder hierarchy with a given regular expression. Handy for navigating large code bases.↩︎

  2. Instead of specifying permissions for the owner, group and world, Access Control Lists let you specify permissions for every user and group individually. On Linux, they can be manipulated with the getfacl and setfacl commands, see info here.↩︎

  3. Extended Attributes are used for example to track if a file was downloaded from the internet or not, which macOS uses to give you that pesky warning asking you if you are really sure you want to open it or not. Extended Attributes let you store arbitrary metadata on filesystem entries.↩︎

  4. Alternate File Streams, also known as (Resource) Forks, use the idea of storing multiple streams of data in a file, besides just the main content. In macOS Classic, these were very commonly used, however in macOS X, only one of them is still accessible. Both HFS+, which is used by Apple, and NTFS, which is used by Microsoft, support them.↩︎

  5. Git, a source code management system, and so much more. It was written by Linus Torvals for use by the Linux kernel developement, however it has become so ubiquitous amongst programmers that the largest platform hosting Git repositories, GitHub, was purchased by software giant Microsoft.↩︎