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.
Today I Learned
Short TIL posts
This page shows how to customize your fastapi 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...
Joe has a sick cli.labs site for deploying tui applications.
html 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.
The htmx response-targets extension allows me to respond to errors from the backend and do normal htmx swaps.
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.
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
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.
To allow access only to the
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.
With the liscense changes to redis there are several new forks out there. One that I am particularly interested in is redka.
curl https://i.jpillora.com/nalgeon/redka | bash chmod +x redka ./redka database.db
We now have redis running on port 6379 that we can connect to with a redis client. And we have a sqlite database that we can inspect.
❯ sqlite3 database.db "SELECT name FROM sqlite_master;" rkey rkey_key_idx rkey_etime_idx rkey_on_type_update rstring rstring_pk_idx vstring rhash rhash_pk_idx rhash_key_id_idx vhash
We can look at the values in the vstring table.
The main system that I am concerned about is my arch BTW machine. I found a great article from the official archlinux site covering it.
For my machine I am concerned with this line.
The xz packages prior to version 5.6.1-2 (specifically 5.6.0-1 and 5.6.1-1) contain this backdoor.
I checked my xz package with AUR.">paru, and I am good.
AUR.">paru has some nice features that I rarely use, and hav to look up when I need them. Here are two commands to help with dependency management.
❯ paru -Qii nodejs Name : nodejs Version : 21.7.2-1 Description : Evented I/O for V8 javascript Architecture : x86_64 URL : https://nodejs.org/ Licenses : MIT Groups : None Provides : None Depends On : icu libuv libnghttp2 libnghttp3 libngtcp2 openssl zlib brotli c-ares Optional Deps : npm: nodejs package manager [installed] Required By : node-gyp nodejs-nopt npm semver Optional For : None Conflicts With : None Replaces : None Installed Size : 46.86 MiB Packager : Felix Yan <[email protected]> Build Date : Thu 04 Apr 2024 05:11:09 AM CDT Install Date : Mon 15 Apr 2024 07:27:02 AM CDT Install Reason : Installed as a dependency for another package Install Script : No Validated By : Signature Backup Files : None Extended Data : pkgtype=pkg
You can...
Jerod (It’s ya boi) and Adam are my favorite tech news nerds, and have the sickest podcasts in tech. Yes plural podcasts they run seven podcasts maybe more. If you want it short and sweet they got the best 15 minutes of tech news each week this is it. My favorite is Ship it, sad to see Gerhard go, but Justin and Autumn are crushing it. Every episode is highly polished and surrounded by the sickest beats in podcasting.
Subscribe to one pod if you want, but I recommend collecting them all with the master feed.
⭐⭐⭐⭐⭐
Small web app to convert html into markdown. Pretty cool idea. I actually want to look into this for reader and see how well it would work. Right now I am just pulling descriptions, but maybe I can pull full web pages, and keep the full intent of the first 200 words or so in the cards.
Award for the creepiest way to stand up a robot from lying flat.
Five star episode with Jarod and Adam shootin the crap.
Sucks that the guest had to back out, what a wild world 2024 is. Filled with license and pricing changes.
...
I recently had to update my copier-gallery command to trust my own templates because some of them have shell scripts that run afterwards. Be warned that this could be a dangerous feature to run on random templates you get off the internet, but these are all mine, so if I wreck it its my own fault.
copier copy --trust <template> <destination>
All the the copier copy api can be found with help.
![[none]]
You can give k3s an install channel to install stable, latest, or specific versions like 1.26. This is handy to make sure that you install the same version on all of your workers.
Today I accidentally ran f2 in ipython to discover that it opens your $EDITOR! I use this feature quite often in zsh, it is bound to <c-e> for me, and since I have my environment variable EDITOR set to nvim it opens nvim when I hit <c-e>. Today I discovered that Ipython has this bound to F2. If you know how to set it to <c-e> let me know I’ve tried, a lot.
export EDITOR=nvim ipython <F2>
better yet add export EDITOR=nvim to your .zshrc