Skip to content

Posts

Session management in Wezterm (without tmux)

Wezterm workspaces

I've been using Neovim as my daily IDE/editor for a bit more than a year now. I've also been using tmux to manage sessions, first using t-smart-tmux-session-manager and later sesh, which supersedes the former project. What's great about this is that it doesn't matter which terminal emulator you use, you can still fall back to this kind of session management.

But the draw screen latency (and complexity) of tmux is annoying and I finally took some time to evaluate the session management capabilities of Wezterm (my currently favorite terminal emulator, which you configure with Lua!) called "workspaces", to see if this could replace tmux altogether for me.

GitHub Pages and Google

Turns out that if you publish a blog (like I do) on GitHub pages, and you want the site to be indexed by Google, it's not so easy.

I'm not sure entirely what the root cause is, but you have to manually add your site in the Google Search Console and then manually add each URL individually for indexing. This discussion outlines the problem perfectly.

Perhaps the reason for this is there are a LOT of pages under the github.io domain, so Google doesn't automatically index it all, or times out. Or perhaps it's because GitHub has some restriction in place which avoids attracting too much traffic to their free hosting solution. 🤷

Here's a more detailed discussion thread which expands more on this topic.

Export repo data from GitHub organization

This is a quickie, using the GitHub CLI and optionally some Python.

Replace YOUR_ORG with your organization and export all your organization's repo data to repos.json:

gh api \
        -H "Accept: application/vnd.github+json" \
        -H "X-GitHub-Api-Version: 2022-11-28" \
        /orgs/YOUR_ORG/repos \
        --paginate > repos.json

Decoupling the ORM class from the data model class

I'm working on a rather large project where we would want to replace a WSGI ORM with an ASGI ORM, but it's tangled up into everything and ORM queries are executed from all over the business logic. If the ORM would've been decoupled from the objects tossed around in the business logic, it would've been much easier to replace the ORM.

This blog post outlines an example of how this can be done with Pydantic. I'm also including a "bonus section" on decoupling the data store communication from the business logic with some inspiration of the "Repository pattern".

Using GitHub merge queue to ease the Dependabot churn

Good morning, project!

$ gh pr list

#1626  chore(deps-dev): bump black from 23.1.0 t...  dependabot/pip/black-23.3.0                  about 7 hours ago
#1625  chore(deps-dev): bump types-requests from...  dependabot/pip/types-requests-2.28.11.17     about 7 hours ago
#1624  chore(deps-dev): bump mkdocs-include-mark...  dependabot/pip/mkdocs-include-markdown-p...  about 7 hours ago
#1623  chore(deps-dev): bump types-redis from 4....  dependabot/pip/types-redis-4.5.3.1           about 7 hours ago
#1622  chore(deps-dev): bump pre-commit from 3.1...  dependabot/pip/pre-commit-3.2.1              about 7 hours ago
#1621  chore(deps-dev): bump types-deprecated fr...  dependabot/pip/types-deprecated-1.2.9.2      about 7 hours ago
#1620  chore(deps-dev): bump types-python-dateut...  dependabot/pip/types-python-dateutil-2.8...  about 7 hours ago
#1619  chore(deps-dev): bump types-redis from 4....  dependabot/pip/types-redis-4.5.3.0           about 7 hours ago
#1618  chore(deps-dev): bump moto from 4.1.4 to ...  dependabot/pip/moto-4.1.6                    about 7 hours ago

-Spits out coffee-

Datadog and custom tracing

When using Datadog for monitoring, Datadog will only record a trace if there is an incoming request.

If there is no incoming request, such as if a cronjob is running, then Datadog will not record a trace and you might not be alerted by an error.

To solve this, you can use the ddtrace-py library and create a custom trace/span whenever tag and tag a span with exception information. This will effectively make it possible to track errors in APM error tracking.

Developing with Apple Silicon

In software development, certain software were not designed to run on the ARM-based Apple Silicon. Thankfully, there are workarounds to install and run the Intel version of these applications. Like for the rest of this blog, this post aims to serve as a personal notebook and also for sharing this knowledge.

When I started looking into solutions to my Macbook Pro M1 challenges, a huge chunk was solved when I had read Ekaterina Nikonova's excellent blog post on Python virtual environments with pyenv on Apple Silicon.

This blog post is heavily influenced by her approach of setting up the app and app86 versions for apps which might need both native and emulated treatment.