Bender Development Diary 1: A Webdev Goes Native

🖊️ 🔖 code linux bender gnome vala 💬 0

I’ve been writing code using Linux as my main OS for over a decade now. Despite this long and fruitful relationship I have yet to do any real native development for this beloved platform.

I tell you what, I can whip up some damn good JSON APIs. But it’s time to try something new. I’ll be creating an application for Linux. Specifically for GNOME. Using GTK.

The creat [sic] Unix System Call

🖊️ 🔖 code linux c 💬 0

The start of section 8.3 of the venerable The C Programming Language by Brain Kernighan and Dennis Ritchie reads:

Other than the default standard input, output and error, you must explicitly open files in order to read or write them. There are two system calls for this, open and creat [sic].

It is very rare to see [sic] in a text about software because typos in software can be fixed. So why here?

Writing a HTTP Server in Zig

🖊️ 🔖 code zig 💬 0

I continue my Zig adventure by following up an echo server with a HTTP server.

I’ve been doing web development the majority of my career. Yet I never really thought too much about HTTP servers, much less what it would take to implement one. So it made perfect sense for me when I started to learn Zig to build one. The problem space is a nice mix of socket programming and string handling.

A Simple Echo Server in Zig

🖊️ 🔖 code zig 💬 0

Recently I’ve been trying to hone my low-level programming skills. Zig is cool and it’s less painful than Rust.

Eventually I’d like to implement a HTTP server. We’ll see if I get there. As a baby step, here is a simple echo server written in Zig:

Should MIT Really be the Default License?

🖊️ 🔖 code 💬 0

When and why did MIT become the default license for open source projects?

I was watching some Fireship videos yesterday and one popped up called The Dark Side of Open Source // What really happened to Faker.js? I am familiar with the story of Aaron Swartz, but I had not heard about faker.js. The author of this extremely popular library got so fed up with companies taking and giving nothing in return that he blanked out the repo and broke it for everyone.

I couldn’t help but notice faker.js was under the MIT license.

What Learning Rust Feels Like

🖊️ 🔖 code memes 💬 0

Learning Rust

I think I’m going to try Zig

A Web Component for Highlighting Remote Code with Prism

🖊️ 🔖 code 💬 0

I was playing around with Web Components and thought it would be neat to be able to display code snippets, but instead of static text load the content from a remote source. For example, displaying the source code for a file hosted on Github inline in a blog post. Thus prism-remote was born.

I’ve been using Kagi for a month and I haven’t missed Google for a minute. Crazy to me how it can absolutely demolish one of the world’s most powerful company’s flagship products.

Wednesday Feb. 28, 2024 7:35 p.m.

The Power of Django, HTMX and django-components

🖊️ 🔖 code django python 💬 0

In this post, I’m going to explore using Django, HTMX, django-components and a slick project layout to build the best todo app you’ve ever seen that doesn’t require React.

A minimal todo app for Waybar

🖊️ 🔖 linux 💬 0

What is the simplest TODO app imaginable? In my opinion, it’s just a text file in your home directory named todo.txt. One line per item, edited with Vim. No need for additional software, websites, or electron apps.

Using standard unix tools, this setup is easy to extend. In my case, I wanted a persistent, nagging reminder of my constant procrastination. I also use waybar. Naturally then the end goal is a custom module.

Image

Obviously, it displays the number of TODOs you have remaining. Additionally, hovering over the module will print display them in a tooltip. When you click a new Neovim instance will spawn opening the file.

Simple and effective. Here’s the code. I placed this is ~/.config/waybar/scripts/todo.sh:

#!/bin/bash
COUNT=$(wc -l < ~/todo.txt)
TODOS=$(cat ~/todo.txt | head -c -1 - | sed -z 's/\n/\\n/g')
printf '{"text": "%s", "tooltip": "%s"}\n' "$COUNT" "$TODOS"

And then add a custom module to ~/.config/waybar/config:

 "custom/todo": {
        "exec": "~/.config/waybar/scripts/todo.sh",
        "return-type": "json",
        "format": "{} todos",
        "on-click": "wezterm -e nvim ~/todo.txt",
        "interval": 5,
    }

Replace wezterm with your preferred terminal emulator and you should be good to go!