testdisk is an amazing command line utility (interactive tui) that just saved me a hard drive that was filled with data, but every machine that I plugged it into told me that it was completely unpartitioned.
Posts tagged: thought
All posts with the tag "thought"
I love rich inspect. Itβs one of my most often used features of rich. It gives you a great human readable insight into python object instances.
>>> from rich import inspect >>> text_file = open("foo.txt", "w") >>> inspect(text_file)
I have a pyflyby entry for it so that I can just run it ang get automatic imports. To not clash with the standard library inspect, which is quite useful on itβs own, I have aliased it to rinspect.
And this is why we donβt run cdn in prod, respect your users who canβt control where the assets are stored. There are so many fast static hosting providers out there, if you are worried about performance reasons use one of those to self host.
A fantastic overview of the systemd cli.
Hacky solution to get zpool import tank to work on boot right away. This has been an issue that has plagued my system for months and no matter what dependencies I add in it never works, but adding a sleep as ExecStartPre did the trick.
In flask apps I often get a 404 for routes with a trailing slash. This Stack Overflow post shows how to configure flask to allow trailing slashes on some or all routes.
sed can be a tricky beast, I often stumble when trying to pipe into it. Next time I need to use sed, I should reference this article by Nick Janetakis. He makes it looks much easier than my experience has been, and it appears to behave like a vim :%s/ substitution does, or a g/ g command.
Getting request headers in fastapi has a pretty nice stetup, it allows you to get headers values as function arguments,
I was able to use headers to detect if a request was made from htmx or not.
If the request was made from htmx, then we want a html format, otherwise Iβm probably hitting the api programatically from something like curl or python
1j01 created a complete working clone of ms paint in the terminal using the textual framework. Itβs incredible.
Loved this explanation about all the recent lock down with RHEL from Jeff Geerling.
...
As the title states sqlite-utils now supports plugins. I dug in just a bit and Simon implemented this completely with entrypoints, no framework or library at all.
Great short explaination of session vs token authentication.
Getting form data inside of fastapi was not intuitive to me at first. Everything I had used in fastapi leaned on pydantic models. Form data comes in differently and needs collected differently.
I am creating this post from a desktop app that I created in 3 lines.
sqlalchemy server_defaults end up as defaults in the database when new values are inserted.
A feature of jinja that I just discovered is including sub templates. Here is an example from the docs.
{% include 'header.html' %} Body goes here. {% include 'footer.html' %}
And inside of my thoughts project I used it to render posts.
<ul id='posts'> {% for post in posts.__root__ %} {% include 'post_item.html' %} {% endfor %} </ul>
note that post_item.html automatically inherits the post variable.
A guide to add Jinja2Templates to fastapi.
A complete reference of all of the htmx swapping methods.
I am trying to use htmx on a new fastapi site for my thoughts, and have been hitting this error.
Mixed Content: The page at 'https://front.mydomain.com/#/clients/1' was loaded over HTTPS, but requested an insecure resource 'http://back.mydomain/jobs/?_end=25&_order=DESC&_sort=id&_start=0&client_id=1'. This request has been blocked; the content must be served over HTTPS.
What is happening #
I have an htmx component that gets the current users name, but if they are not logged in the backend redirects to a login form.
<div hx-get='/users/me' hx-trigger='load'> get me </div>
But for some reason when the front end gets this redirect, it tries to do it through http,...
...