Published

All published posts

2540 posts latest post 2026-06-16 simple view
Publishing rhythm
May 2026 | 58 posts
The work on datastar [1] by starfederation [2]. The hypermedia framework. References: [1]: https://github.com/starfederation/datastar [2]: https://github.com/starfederation
Fields Pydantic Docs · docs.pydantic.dev [1] exclude=True and repr=False is a good pydantic combination for secret attributes such as user passwords, or hashed passwords. exclude keeps it out of model_dumps, and repr keeps it out of the logs. from pydantic import BaseModel, Field class User(BaseModel): name: str = Field(repr=True) age: int = Field(repr=False) user = User(name='John', age=42) print(user) #> name='John' References: [1]: https://docs.pydantic.dev/2.7/concepts/fields/#field-representation

just has been by go to tool for saving commands in a way that I can replay them and have team members replay them without relying on the shell history of any given machine. This is my go to default step, it lets you pick a just command to run with a fuzzy picker.

default:
  @just --list
Hatch v1.10.0 - Hatch hatch.pypa.io [1] Hatch be flyin. This new release of hatch includes support for the new package installer uv which is just mind blowing fast compared to anything else we have in python right now. [tool.hatch.envs.default] installer = "uv" The other features are cool too, check them out. I’ll probably be using the test runner, but I’ve been waiting for the uv support since uv launched. References: [1]: https://hatch.pypa.io/latest/blog/2024/05/02/hatch-v1100/
External Link loggly.com [1] I had a boot issue on my sons fresh ubuntu 24.04 install and journalctl came in clutch. journalctl -p 3 -xb - -p 3 gives me priority 3 - -x gives me extra catalog information when available - -b gives me the current boot. References: [1]: https://www.loggly.com/ultimate-guide/using-journalctl/
Bug #2006590 “gdm3 crashes with SIGTRAP on startup” : Bugs : gdm3 package : Ubuntu Suddenly this week, my GUI (ubuntu 22.10) does not open, stuck on the console text. I tried to free some space (by uninstall a app), then to check/update the paquets (dkpg). ProblemType: Bug Distr… Launchpad · bugs.launchpad.net [1] This Thread saved my son’s ubuntu 24.04 install. His was failing to start with the following error. Gdm: GdmSession: no session desktop files installed, aborting... https://twitter.com/_WaylonWalker/status/1785825677079441482 sudo apt install --reinstall ubuntu-session References: [1]: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/2006590
GitHub - Alir3z4/html2text: Convert HTML to Markdown-formatted text. Convert HTML to Markdown-formatted text. Contribute to Alir3z4/html2text development by creating an account on GitHub. GitHub · github.com [1] Super neat tool to convert html [2] to markdown >>> import html2text >>> >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) <!--markata-attribution--> **Zed's** dead baby, _Zed's_ dead. It even plays nicely with rich. from rich.markdown import Markdown from rich.console import Console import html2text console = Console() md = Markdown(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>")) console.print(md) References: [1]: https://github.com/Alir3z4/html2text [2]: /html/
How an empty S3 bucket can make your AWS bill explode Imagine you create an empty, private AWS S3 bucket in a region of your preference. What will your AWS bill be the next morning? Medium · medium.com [1] Imagine waking up to a $1,300 for running an example project! That sounds like peanuts for a cloud bill but for an individual trying to learn that hits my monthly budget real hard. That’s what happened to Marciej, make sure you check out the full article and give them a 👏 on Medium if you have an account. The more I see things come out about aws, the more it makes me sick, and confirm my feelings that I cannot possibly use them for a side project without some real $$ planning to come out of it. Yes, S3 charges for unauthorized requests (4xx) as well[1]. That’s expected behavior. They offer no DDOS protection against 4xx or 5xx requests against your bucket. Absolutely bonkers that you have ZERO control over this. --- This response just feels absolutely gross. I notified the AWS security team. I suggested that they restrict the unfortunate S3 bucket name to protect their customers from unexpected charges, and to protect the impacted companies from data leaks. But they ...
Media Types iana.org [1] A full list of standard Accept types. This is a handy reference. References: [1]: https://www.iana.org/assignments/media-types/media-types.xhtml#text
![https://docs.pydantic.dev/2.7/api/networks/#pydantic [1].networks.EmailStr](/static/https://docs.pydantic.dev/2.7/api/networks/#pydantic [1].networks.EmailStr) pydantic has a nice built in email validator EmailStr It requires an optional pydantic dependency pip install email-validator Then you can validate email addresses. from pydantic import BaseModel, EmailStr class Model(BaseModel): email: EmailStr print(Model(email='[email protected]')) #> email='[email protected]' References: [1]: /tags/pydantic/
[1] This is my go to rich response container for clis written in python. It creates a nice box around the content on the screen and provides some nice separation in the output. It can be overdone, but comes in clutch when looking for that print statement in a long output. References: [1]: /static/https://rich.readthedocs.io/en/stable/reference/panel.html
Handling Errors - FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi.tiangolo.com [1] This page shows how to customize your fastapi [2] errors. I found this very useful to setup common templates so that I can return the same 404’s both programatically and by default, so it all looks the same to the end user. from fastapi import FastAPI, Request from fastapi.responses import JSONResponse class UnicornException(Exception): def __init__(self, name: str): self.name = name app = FastAPI() @app.exception_handler(UnicornException) async def unicorn_exception_handler(request: Request, exc: UnicornException): return JSONResponse( status_code=418, content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."}, ) @app.get("/unicorns/{name}") async def read_unicorn(name: str): if name == "yolo": raise UnicornException(name=name) return {"unicorn_name": name} --- This post sat in draft for months. I stumbled upon it again and found great success returning good error messages based on user preferences. the default remains json, but if a user requests text/html it will be an html [3] response, and text for ...
Creating SSH Apps with Charm Wish and Laravel Prompts Building PHP CLI apps with Laravel Prompts is easy, but how can we share them? Charm to the rescue! Charm Wish is an easy-to-use SSH server that allows users to securely log into your server and us... Joe Tannenbaum · blog.joe.codes [1] Joe has a sick cli.labs site for deploying tui applications. ssh cli.lab.joe.codes References: [1]: https://blog.joe.codes/creating-ssh-apps-with-charm-wish-and-laravel-prompts
white-space CSS property - CSS | MDN The white-space CSS property sets how white space inside an element is handled. MDN Web Docs · developer.mozilla.org [1] html [2] can preserve newline \n characters by styling an element with white-space: pre-wrap; pre-wrap Sequences of white space are preserved. Lines are broken at newline characters, at , and as necessary to fill line boxes. References: [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space [2]: /html/
htmx ~ The htmx Response Targets Extension Extension htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypert... htmx.org [1] The htmx [2] response-targets extension allows me to respond to errors from the backend and do normal htmx swaps. Note by default htmx will only swap on 200 and 300 responses Load the extension in head <script src="https://unpkg.com/[email protected]/dist/ext/response-targets.js"></script> Use the extension on an endpoint that might return a 400. <div hx-ext="response-targets"> <div id="response-div"></div> <button hx-post="/register" hx-target="#response-div" hx-target-5*="#serious-errors" hx-target-404="#not-found"> Register! </button> <div id="serious-errors"></div> <div id="not-found"></div> </div> References: [1]: https://htmx.org/extensions/response-targets/ [2]: /htmx/
https://boot.dev/blog/devops/how-to-restart-all-pods-in-a-kubernetes-namespace/ blog.boot.dev [1] As of kubernetes 1.15 there is an easy way to restart all pods in a deployment. kubectl -n {NAMESPACE} rollout restart deploy Thanks Lane give him a follow @wagslane [2] References: [1]: https://blog.boot.dev/open-source/how-to-restart-all-pods-in-a-kubernetes-namespace/ [2]: https://twitter.com/wagslane

TIL how to display the list of nfs mounts on your network.

showmount -e

You can even look for mounts of other machines on your network.

showmount -e <hostname>

To allow access only to the , you can pass add the Resource field to the User Policy when you create a new token.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "admin:*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "kms:*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:*"
      ],
      "Resource": [
        "arn:aws:s3:::<bucket>",
        "arn:aws:s3:::<bucket>/*"
      ]
    }
  ]
}

You can inspect sqlite tables with the sqlite shell.

note that you get into the shell with sqlite3 database.db

.tables

I also learned that .tables, .index and .schema are helper functions that query the sqlite_master table on the main database.

Here is an output from my redka database. The sqlite_master table contains all the sqlite objects type, name, tbl_name, rootpage, and sql to create them.

❯ sqlite3 database.db "SELECT * from sqlite_master;"
table|rkey|rkey|2|CREATE TABLE rkey (
    id       integer primary key,
    key      text not null,
    type     integer not null,
        version  integer not null,
    etime    integer,
        mtime    integer not null
)
index|rkey_key_idx|rkey|3|CREATE UNIQUE INDEX rkey_key_idx on rkey (key)
index|rkey_etime_idx|rkey|4|CREATE INDEX rkey_etime_idx on rkey (etime)
where etime is not null
trigger|rkey_on_type_update|rkey|0|CREATE TRIGGER rkey_on_type_update
before update of type on rkey
for each row
when old.type is not new.type
begin
    select raise(abort, 'key type mismatch');
end
table|rstring|rstring|5|CREATE TABLE rstring (
    key_id integer not null,
    value  blob not null,

    foreign key (key_id) references rkey (id)
          on delete cascade
)
index|rstring_pk_idx|rstring|6|CREATE UNIQUE INDEX rstring_pk_idx on rstring (key_id)
view|vstring|vstring|0|CREATE VIEW vstring as
  select
    rkey.id as key_id, rkey.key, rstring.value,
        datetime(etime/1000, 'unixepoch') as etime,
        datetime(mtime/1000, 'unixepoch') as mtime
  from rkey join rstring on rkey.id = rstring.key_id
  where rkey.type = 1
    and (rkey.etime is null or rkey.etime > unixepoch('subsec'))
table|rhash|rhash|7|CREATE TABLE rhash (
    key_id integer not null,
    field text not null,
    value blob not null,

    foreign key (key_id) references rkey (id)
      on delete cascade
)
index|rhash_pk_idx|rhash|8|CREATE UNIQUE INDEX rhash_pk_idx on rhash (key_id, field)
index|rhash_key_id_idx|rhash|9|CREATE INDEX rhash_key_id_idx on rhash (key_id)
view|vhash|vhash|0|CREATE VIEW vhash as
  select
    rkey.id as key_id, rkey.key, rhash.field, rhash.value,
        datetime(etime/1000, 'unixepoch') as etime,
        datetime(mtime/1000, 'unixepoch') as mtime
  from rkey join rhash on rkey.id = rhash.key_id
  where rkey.type = 4
    and (rkey.etime is null or rkey.etime > unixepoch('subsec'))