Reading books and commenting on them with ChatGPT

I just finished reading Paul Auster’s The New York Trilogy1. On this occasion, I discovered a new use for ChatGPT and LLMs. ChatGPT and I chatted about the themes, especially the correlations and connections between the three short novels that comprise the volume. It was an alienating and revealing experience. For the first time, I am reasoning about a book with a machine, not a person. Because it knows everything about the text and draws on the shared global knowledge, it can give more satisfaction than most people do (also, it’s not easy to find someone around with whom I can talk about all the books I read!...

November 26, 2024

Under ASP.NET 8, NGINX returns 502 Bad Gateway after authentication by IdentityServer

Today, I learned the hard way that NGINX has default buffer sizes, which can cause trouble in specific scenarios like mine.

September 12, 2024

ShellCheck

Today I learned about ShellCheck, a static analysis tool that “finds bugs in your scripts”. It can and should be run on the command line, but an online version is also available. It catches most style and syntax errors and has plenty of options, like ignoring specific errors and warnings, which is helpful in CI scenarios.

July 24, 2024

Bash-Oneliner: a collection of terminal tricks for Linux

Bash-Oneliner is an excellent resource for Bash/Linux users. Most of the “tricks” are well-known, but there is always something to learn. More importantly, finding them all well organized in one file is rare. I use the reverse lookup of bash-history (Ctrl+R) daily. Still, only today (thanks to an HN comment on Bash-Onliner) did I learn that it also preserves one’s comments, which can be exploited to invoke complex commands quickly:...

July 22, 2024

How to handle custom claims in an Open ID Connect-authenticated ASP.NET Core app

Today, I learned how to handle custom claims in an Open ID Connect authenticated ASP.NET Core app. The scenario goes like this. I have an ASP.NET Core app that authenticates with Open Id Connect. It receives a bearer token from the authentication server. Besides OIDC claims, this token has been forged with additional custom claims for use in the app. However, only ODIC claims exist when I parse HttpContext.User.Identity.Claims in my middleware....

May 31, 2024

ChatGPT is the perfect Linux assistant

I spent the day doing remote maintenance on multiple Linux machines via ssh. The revelation is that ChatGPT is the bomb for these tasks: What does that command option do? I am trying to remember. What syntax is to install that peculiar and rarely used package on Debian? I am getting this locale configuration error; what was the fix again? All this stuff is answered much sooner than searching online, no matter the search engine....

March 29, 2024

SQLite foreign key constraints are disabled by default

Today, I learned that SQLite only enforces foreign-key constraints if explicitly instructed. I imagine this is well-known and trivial for the SQLite initiated, but we’re a Postgres shop; I have used SQLite sporadically, primarily for experiments like today’s, and this one amenity was certainly unexpected. Anyways. I had all my ON DELETE CASCADE constraints nicely configured, but related records in child tables were not being deleted when I deleted the parent....

February 22, 2024

Default ASP NET Core 8 port changed from 80 to 8080

Today, I learned the hard way that the default port for ASP.NET Core 8 container images has been updated from port 80 to 8080, quite a remarkable breaking change. We upgraded our web application from .NET 7 and let the CI pipeline do its work. Finally, we checked the application in the browser to ensure everything was okay, but unfortunately, we got a 502 Bad Gateway error. The Nginx logs revealed that the app was rejecting connections, which was unexpected because we didn’t make any changes there....

February 20, 2024

GitHub Wikis don't allow edits or pull requests

Today I learned that GitHub wikis are not editable online and do not support pull requests. You can clone and edit a wiki locally but not return your change to the original repository. I don’t use wikis in my projects; I prefer documentation to stay with the project, usually in a dedicated directory, and publish it on a dedicated site through GitHub Pages. But today was different as I opened a pull request for PaperMod, the Hugo theme I use on this website....

February 9, 2024

pg_dump and pg_restore can backup and restore single Postgres schemas

Today I learned that pg_dump can make a copy of a Postgres schema instead of the whole database. Likewise, if needed, pg_restore can restore the schema in either the original database or a different one. Backup of a Postgres schema: pg_dump -h host -d source_database -U user -n schema_name -F c -f schema_dump_file.dump Restore of a Postgres schema: pg_restore -h host -d dest_database -U user -n schema_name schema_dump_file.dump All primary and shared knowledge, I am sure....

January 30, 2024