blog Dotfiles in External Worktree

As a developer, I tend to keep all kinds of things beyond just code managed with git.

In the past I have used a ~/.dotfiles repo with multiple symlinks, though there are alternate ways to handle it.

Having remembered that bare repositories and alternate work-trees are a thing, I did a short search before finding a tutorial. Initially using their example directly, we arrive at commands that look like this.

Read More →

blog Offline Code Reference

While most code forges have a decent way of navigating code, going back and forth becomes tedious and it can often be easier to check things offline. The trick I use on my machine, is to combine alfred and a alfred-repos plugin for helping make things easier to search.

Using my own forked version to add some icons, I have a configuration file that looks like this.

{
  "__workflow_last_version": "4.1.0",
  "app_alt": "Terminal",
  "app_cmd": "Gitup",
  "app_default": "Visual Studio Code",
  "app_ctrl": "Browser",
  "global_exclude_patterns": [],
  "search_dirs": [
    // Projects is self explanitory
    {
      "depth": 2,
      "path": "~/Projects",
      "icon": "project.png"
    },
    // References is any 3rd party code I might want to view
    {
      "depth": 2,
      "path": "~/References",
      "icon": "references.png"
    },
    // I keep some documents in git as well
    {
      "depth": 2,
      "icon": "document.png",
      "path": "~/Documents"
    }
  ]
}

Adding icons gives me an extra visual hint what type of repo is found from Alfred.

Read More →

blog Making a Start Page

Even though I wrote about it in a previous week note I have not been using my start page to much yet. Yesterday I randomly decided to start using it after cleaning a few things up. Combined with my dev server I had some of the pieces ready.

First, I configured Firefox to change my start page to start.localhost, where I have my page running. Unfortunately, while you can configure the home page, you can not currently configure the new tab page.

Read More →

blog Norikae Dev Server

Over a year ago, I wrote my first draft dev proxy launcher in Async Python, based on an idea I had to have something like xinetd for my various in development projects.

[service.django]
host = "django.localhost"
port = 8001
cwd = "~/Projects/my-django-project"
command = "uv run manage.py runserver {port}"
delay = 3

[service.hugo]
host = "hugo.localhost"
port = 8002
cwd = "~/Projects/my-hugo-site"
command = "hugo server --buildDrafts --buildFuture --port {port}  --liveReloadPort 80"

While the Python version validated the idea, and usually worked well, there were a few cases that did not work as well.

Recently, I decided to work on a new version using rust and hyper to handle the proxied requests, which I have named Norikae (乗り換え).

Read More →

blog Attempting a Windows Service

On my Mac, I wrote a small nagger app to help remind me when I may have extended a break too long. It is connected via mqtt to a hardware bell I have on my desk.

Recently I have been spending a bit too much time in Factorio so wanted to see if I could make a similar version on Windows.

I have not previously used my Windows PC for development (I do all of my work on MacOS or Linux), so the first step was to install VSCode, uv , and git. This was not particularly difficult and recently it seems like installers automatically handled updating PATH for powershell.

Read More →

blog Entry Points With Enums

While updating my PowerPlug ( pypi ) project, I implemented a pattern I have started using in a few other places that I use entry-points .

By creating a custom enum using one of Django’s enumeration-types , you can make it much easier to load these modules.

from importlib import metadata

from django.db import models
from django.utils.translation import gettext_lazy as _

class EntryPoints(models.TextChoices):
    APPS = "powerplug.apps", _("Installed Apps")
    REST = "powerplug.rest", _("Installed APIs")
    SIGNAL = "powerplug.signal", _("Installed Signals")
    TASK = "powerplug.task", _("Installed Tasks")
    URLS = "powerplug.urls", _("Installed URLs")
    CONTEXT = "powerplug.context", _("Installed context processor")

    def group(self) -> metadata.EntryPoints:
        return metadata.entry_points(group=self.value)

Using an enum like this, makes it very easy to load one of our entry points, while keeping all the definitions for our app in a single place.

Read More →

blog Exploring Python Requirements

Recently like a lot of my Python follows, I have been using uv to manage a lot of my python projects.

Given a project, uv tree will show you a nice tree view of your requirements.

wheat v0.1.0
├── click v8.1.8
├── inquirer v3.4.0
│   ├── blessed v1.20.0
│   │   ├── six v1.17.0
│   │   └── wcwidth v0.2.13
│   ├── editor v1.6.6
│   │   ├── runs v1.2.2
│   │   │   └── xmod v1.8.1
│   │   └── xmod v1.8.1
│   └── readchar v4.2.1
└── tomlkit v0.13.2

You can also do something like uv pip list to show it in list form. Both support a --outdated flag to show you packages needing updates.

Read More →

blog git-pending

Mostly for scripting reasons and alerting reasons, there are multiple times when I have wanted a simple status of a repository. When working from the console, there is git-status which shows things in a human parsable format, but for scripts we need something more robust.

We can ue git-status with the –porcelain=2 flag to provide a lot more information, in a more easily machine parsable format. Seeing how starship parsed git-status helped me on this path.

Using this information, I wrote my own git-pending command to parse this data, into a form I could script against more easily.

Read More →

blog Close all the Tabs

I do not (usually) think of myself a hoarder, but any kind of reading online seems to result in a browser full of tabs (as xkcd humorously illustrates).

Even though desktop has more room to handle tabs, I find that even light research or troubleshooting can result in dozens of tabs, and after a point, only the favicon remains. When switching to a new task, I usually find it easier to close everything and start from scratch though I tend to bookmark to raindrop anything I might want later.

Read More →