Recently, I implemented a RISC-V simulator and assembler in AWK: awk-riscv. This started as a joke, evolved into wanting to prove a point (namely, that AWK being a Turing-complete language, can compute anything which is compute-able) , and ended up being a lot of fun. I will provide a narrative overview of the riscv.awk program, and also discuss more broadly the basics of writing a CPU simulator. Even if you don’t know AWK, but want to learn about CPU simulators, you’ll probably be able to follow this article.
Polling sucks, but inter-process communication (IPC) is hard. Sometimes you have two programs that need to coordinate, and you just want a simple way for one to tell the other “hey, new information is ready, go look at it”. Here’s a trick I picked up from xidle(1)… I’m sure other programs have used it, but this is where I got the idea. You may be familiar with UNIX signals (see signal(3) on OpenBSD, and signal(7) on Linux), which allow one program to interrupt another.
Those that know me will know that I generally prefer to run OpenBSD when I have a choice. However, I found myself needing to run a number of Linux-specific software packages. As Ubuntu is the most common (or at least among the most common) Linux distribution, I settled on that – most commercial software that targets Linux specifically sports Ubuntu. It’s taken a lot of trial, error, and scouring the internet to collect the required information to build a usable (by my standards) desktop experience based on Ubuntu 18, so I thought it might be helpful to others to document what I’ve figured out so far.
Over winter break, some friends and I decided to spend a week working on a programming project. One challenge was playing music - deciding whose computer to use, which person’s music library to use, and so on. To make it easier for everyone to play the tracks they wanted, we set up a spare laptop as a jukebox. A simple shell script which we’ll discuss below served as a server - people could send it a URL (such as a YouTube video) via netcat and it would automatically play each link using mpv one at a time in a first-come-first-serve order.
Sometimes you just can’t get around needing to run an interactive program for an extended period of time; game servers are frequent culprits - remaining as interactive foreground processes which require input from the console to be operated. In this article, we’ll see how to run an interactive program (in this case a Bash shell) as a background daemon using a systemd unit file. Background In principle, the procedure we are about to employ would have worked decades ago on even relatively early versions of UNIX - all we really need is POSIX jobs, redirects, and named pipes (FIFOs).
As regular readers will have noticed by the time this article is posted, cdaniels.net is no longer running Jekyll. Instead, it is generated by a new, fully custom static site generator which I have written as a day project during Thanksgiving Break. This new static site generator offers a number of advantages: It produces more visually appealing output (in my opinion) It is easier for me to maintain It requires less dependencies to run (no more Ruby, just make and sh) cdaniels.
In this guide, I will discuss how you can go about running a headless factorio game server on your FreeBSD server. My server is an AMD64 system running FreeBSD 11-RELEASE, although to my knowledge nothing in this guide is specific to this version of FreeBSD. In particular, this guide will cover: Installing and running the Factorio standalone server. Writing a FreeBSD rc.d script to run the Factorio server as a system service.
In this article, you will learn how to use the Make build system to compile software projects. This article is targeted at those who have experience programming, but are not deeply familiar with the shell or commandline build systems. However, this article does assume you have basic familiarity with the UNIX commandline. I decided to write this article because, in my experience observing my peers, and in 2 semesters of TAing an intro to UNIX class, Make seems to perpetually be a sticking point for new users.
As a computer scientist, Physics Lab seemed like a great way to practice my LaTeX skills - every week, each student in Physics 211L had to produce a formal lab report covering that week’s experiment. This post details my experience developing a LaTeX template, as well as discovering and selecting tools and methods for processing data and producing figures. NOTE: This webpage uses MathML, it may not look correct in browsers other than FireFox and Safari.
A little known tool baked into OSX is autofs, also available for Linux, which automatically mounts filesystems when they become available. This is useful for several reasons. Namely, it saves you from having to open the terminal and type a mount command, or mounting through finder’s connect to server dialog. Additionally, autofs should make OSX more fault tolerant in the event that the device becomes unreachable, although I have yet to test this in real world applications.