Posts tagged: thought

All posts with the tag "thought"

871 posts latest post 2026-06-01
Publishing rhythm
May 2026 | 24 posts
Filter Data - WHERE - SQLModel SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. sqlmodel.tiangolo.com [1] When fetching pydantic models from the database with sqlmodel, and you cannot select your item by id, you probably need to use a where clause. This is the sqlmodel way of doing it. Here is a snippet of how I am using sqlmodel select and where to find a post by link in my thoughts database. @post_router.get("/link/") async def get_post_by_link( *, session: Session = Depends(get_session), link: str, ) -> PostRead: "get one post by link" link = urllib.parse.unquote(link) print(f'link: {link}') post = session.exec(select(Post).where(Post.link==link)).first() if not post: raise HTTPException(status_code=404, detail=f"Post not found for link: {link}") return post 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://sqlmodel.tiangolo.com/tutorial/where/#filter-rows-using-where-with-sqlmodel [2]: /thoughts/
URL Decoding query strings or form parameters in Python | URLDecoder URL Decode online. URLDecoder is a simple and easy to use online tool for decoding URL components. Get started by typing or pasting a URL encoded string in the input text area, the tool will automa... urldecoder.io [1] In order to turn url encoded links back into links that I would find in the database of my thoughts project I need to urldecode them when they hit the api. When anything hits the api it must urlencode the links in order for them to be sent correctly as data and not get parsed as part of the url. Here is a snippet of how I am using urlib.parse.unquote to un-encode encoded urls so that I can fetch posts from the database. @post_router.get("/link/") async def get_post_by_link( *, session: Session = Depends(get_session), link: str, ) -> PostRead: "get one post by link" link = urllib.parse.unquote(link) print(f'link: {link}') post = session.exec(select(Post).where(Post.link==link)).first() if not post: raise HTTPException(status_code=404, detail=f"Post not found for link: {link}") return post Note This post is a thought [2]. It’s a short note that I make about someone else’s content ...
encodeURIComponent() - JavaScript | MDN The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will ... MDN Web Docs · developer.mozilla.org [1] In order to send data that includes special characters such as / in a url you need to url encode it. You have probably seen these many times in urls with things like %20 for spaces. I’m working on a chrome extension to make quick blog posts, like thoughts or a persistent bookmark tool with comments. The backend is written in fastapi [2] and when I check to see if I have a post for a page I need to url encode it. curl -X 'GET' \ 'https://thoughts.waylonwalker.com/link/?link=https%3A%2F%2Fhtmx.org%2Fextensions%2Fclient-side-templates%2F' \ -H 'accept: application/json' curl example generated from the fastapi swagger docs. Here is how I used javascript’s encodeURIComponent to turn my chrome extension into a notification when I already have a post for the current page. // Event listener for tab changes chrome.tabs.onActivated.addListener(function (activeInfo) { // Get the active tab information ...
🛠️ Installation | LazyVim You can find a starter template for LazyVim here lazyvim.org [1] Lately in 2023 I have been leaning on lazyvim for my new setups where I am not necessarily ready to drop my full config. It’s been pretty solid, and comes with a very nice setup out of the box, the docs are pretty fantastic as well. 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.lazyvim.org/installation [2]: /thoughts/
[1]@changelog [1]) on X — 🗣️ @kelseyhightower on his demos: That happy path gets people out of their chairs. They’re going back to the computer, like: “Yo, I’m gonna try it right now.” Come on… I’d rather have that. And I’ll take the bit of criticism that comes with it. https://t.co/m9r2KZjNQO" [2] loading=“lazy”> Changelog (@changelog [3]) on X 🗣️ @kelseyhightower on his demos: That happy path gets people out of their chairs. They’re going back to the computer, like: “Yo, I’m gonna try it right now.” Come on… I’d rat… X (formerly Twitter) · twitter.com Such an inspiring clip from Kelsey Heightower. Make good shit that inspires people rather than fake ppts of how things could be. 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://twitter.com/changelog/status/1681306857951084544 [2]: https://t.co/m9r2KZjNQO%22 [3]: https://changelog.com/podcast [4]: /thoughts/
[1]@chriscoyier [1]) on X — I was unaware of `text-wrap: pretty;` I knew about the (new/cool) text-wrap: balance; — but sometimes that's a bit… too much. I feel like it's nice on headers but not smaller type. Here's what I mean." loading=“lazy”> Chris Coyier (@chriscoyier [2]) on X I was unaware of text-wrap: pretty; I knew about the (new/cool) text-wrap: balance; — but sometimes that's a bit… too much. I feel like it's nice on headers but not smaller type. Here's w… X (formerly Twitter) · twitter.com Next time I’m working with large headers on small screens I need to try this. I always truggle to get them to look good for most text and overflow ridiculously long words correctly or at all. text-wrap: pretty; text-wrap: balance 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://twitter.com/chriscoyier/status/1681407724993798144 [2]: https://chriscoyier.net [3]: /thoughts/
Full-text search - Datasette documentation docs.datasette.io [1] Enable full-text search in sqlite using sqlite-utils. $ sqlite-utils enable-fts mydatabase.db items name description 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.datasette.io/en/latest/full_text_search.html#enabling-full-text-search-for-a-sqlite-table [2]: /thoughts/
sqlite-utils command-line tool - sqlite-utils sqlite-utils.datasette.io [1] I want to like jq, but I think Simon is selling me on sqlite, maybe its just me but this looks readable, hackable, editable, memorizable. Everytime I try jq, and its 5 minutes fussing with it just to get the most basic thing to work. I know enough sql out of the gate to make this work off the top of my head curl https://thoughts.waylonwalker.com/posts/ | sqlite-utils memory - 'select title, message from stdin where stdin.tags like "%python%"' | jq 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://sqlite-utils.datasette.io/en/stable/cli.html#querying-data-directly-using-an-in-memory-database [2]: /thoughts/
sqlite-utils command-line tool - sqlite-utils sqlite-utils.datasette.io [1] insert a json array directly into into sqlite with sqlite-utils. echo '{"name": "Cleo", "age": 4}' | sqlite-utils insert dogs.db dogs - 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://sqlite-utils.datasette.io/en/stable/cli.html#inserting-json-data [2]: /thoughts/
LZone LZone - Cheat Sheets for Sysadmin / DevOps / System Architecture lzone.de [1] A nice cheat sheet for jq. jq looks so nice, but it so quickly gets overwhelming on how to select what you want. I was able to make a jq contains query. curl https://thoughts.waylonwalker.com/posts/ | jq '.[] | select(.title | contains("python"))' 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://lzone.de/cheat-sheet/jq [2]: /thoughts/