Safer Bash Shebang Recipes - Just Programmer's Manual
just.systems [1]
When using justfiles each line is ran separately from the last, unless you specify the file to be ran by something other than just such as bash. If you want variables to persist you need to set a shebang.
Also if you are using your script i a way that you want it to exit when it fails you need to set -e and -o pipefail. This is critical if you are thinking about using just for production scripts like ci/cd. I’ve hit too bugs where ci passes, but no artifacts were created issues for this exact reason.
foo:
#!/usr/bin/env bash
set -euxo pipefail
hello='Yo'
echo "$hello from Bash!"
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://just.systems/man/en/safer-bash-shebang-recipes.html?highlight=pipefail#safer-bash-shebang-recipes
[2]: /thoughts/
Today I Learned
Short TIL posts
1852 posts
latest post 2026-05-13
Publishing rhythm
Justfile Cheat Sheet
Just is a command runner https://github.com/casey/just
Cheatography · cheatography.com [1]
This is a dope ass cheat sheet for justfiles. It’s filled with good examples that are short and to the point, probably all from the docs, but anyways I need to do some like this for myself.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://cheatography.com/linux-china/cheat-sheets/justfile/
[2]: /thoughts/
A quote from Tim Paul
I’m no developer, but I got the AI part working in about an hour. What took longer was the other stuff: identifying the problem, designing and building the UI, setting …
Simon Willison’s Weblog · simonwillison.net [1]
Damn this Tim Paul quote finishes hard and such a good point. None of the stuff around llms just work. Good ui’s, front end, back end, infrastructure, product. All these things still need to exist, and in fact for ai to be good we need to still go hard on them otherwise everything will die in a heaping pile of ai slop [2]
I’m no developer, but I got the AI part working in about an hour.
What took longer was the other stuff: identifying the problem, designing and building the UI, setting up the templating, routes and data architecture.
It reminded me that, in order to capitalise on the potential of AI technologies, we need to really invest in the other stuff too, especially data infrastructure.
It would be ironic, and a huge shame, if AI hype sucked all the investment out of those things.
— Tim Paul [3]
Note
This post is a thought [4]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https:...
PopSQL - Collaborative SQL Editor - Bring Order to SQL Chaos
PopSQL is a unified SQL collaboration workspace that connects everyone in the data analysis process so you can obtain better insights by asking the right questions, together.
PopSQL · popsql.com [1]
PopSql looks like a very innovative product to bring collaboration to data exploration and visualization in a way you would expect from something like vscode liveshare. This looks far more appealing than a traditional BI data tool.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://popsql.com/
[2]: /thoughts/
Pricing | PopSQL
PopSQL is a unified SQL collaboration workspace that connects everyone in the data analysis process so you can obtain better insights by asking the right questions, together.
PopSQL · popsql.com [1]
interesting pricing model from popsql (pronounces Popsicle). At a glance you pay for data retention, want the abiltiy to recall all the queries you ran within the last year, run at a higher frequency, you jump a pricing tier.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://popsql.com/pricing
[2]: /thoughts/
-
such a sick episode with dax.
SST’s free tier will be free as long as aws allows a free tier, their free tier literally costs them nothing.
They talked about keeping SST small, the limitations that brings, but also the number of problems that just go away when you only have 3 people building. Lots of process disappears, everyone can trust everyone, no one needs to wait for approval, everyone is their own PM and just builds cool shit. They don’t have to worry about big costs and making payroll because they are profitable so much higher than their costs.
If they can get through phase one of just being the go platform for a very specific audience of users, and gain marketshare, the ideas of offerings on top of this are endless.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
-
I had no idea that you could just drop an msi installer right in steam. This worked for me, and was much easier to install pokemon tcg live in 05-2024 on ubuntu 22-04. I added the msi to steam from my downloads, hit start, failed right away like he said it would. changed compatability to proton experimental, and it opened right up.
- Download the official installer from pokemon tcg
- Add non steam game
- click show all file types
- navigate to downloaded msi
- click gear icon > compatability > proton experimental
- click play
- profit
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
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'
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://docs.pydantic.dev/2.7/concepts/fields/#field-representation
[2]: /thoughts/
just [1] 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
References:
[1]: https://github.com/casey/just
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.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://hatch.pypa.io/latest/blog/2024/05/02/hatch-v1100/
[2]: /thoughts/
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.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.loggly.com/ultimate-guide/using-journalctl/
[2]: /thoughts/
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
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/2006590
[2]: /thoughts/
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>"))
**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)
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/Alir3z4/html2text
[2]: /html/
[3]: /thoughts/
-
Fantastic interview with Uncle Bob, really it was more of a 2 way conversation. So many of Uncle Bob’s takes have been taken out of context, its cool to hear some of the well actuallys, and the experience behind some of the reasoning.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
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.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.iana.org/assignments/media-types/media-types.xhtml#text
[2]: /thoughts/
![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]'
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /tags/pydantic/
[2]: /thoughts/
[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.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /static/https://rich.readthedocs.io/en/stable/reference/panel.html
[2]: /thoughts/
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 ...