Optimizing SQLite for servers
SQLite is often misconceived as a "toy database", only good for mobile applications and embedded systems because it's default configuration is optimized for embedded use cases, so most ...
Sylvain Kerkour Ā· kerkour.com [1]
Very interesting article by Sylvain, suggested by Simon Willison.
Definitely some things that I want to come back and try later on.
Here is the TLDR of the whole post
PRAGMA journal_mode = WAL;
PRAGMA busy_timeout = 5000;
PRAGMA synchronous = NORMAL;
PRAGMA cache_size = 1000000000;
PRAGMA foreign_keys = true;
PRAGMA temp_store = memory;
This is interesting, and something I need to consider. I definitely have an application with slow count queries. I am not sure how to make it better as its not a full count(*) so a count table doesnāt work, nor does counting by index.
I might need to have a table of cached results, and if a write matches the counter increase it, or update all counters on write.
COUNT queries are slow
SQLite doesnāt keep statistics about its indexes, unlike PostgreSQL, so COUNT queries are slow, even when using a WHERE clause on an indexed field: SQLite has to scan for all the matching records.
One solution...
Published
All published posts
2493 posts
latest post 2026-05-11
Publishing rhythm
-
Inspiring story transitioning into tech from nursing. I also came to tech through a set of circumstances that made it difficult for me to excel at my current job. Looking back it is something that I was always interested in and I was just unsure how to get in, I am so glad that I figured it out, it has been such a great benefit to my family.
I really enjoyed listening to trshpuppyās journey in through building projects, and choosing tech not based on what she wanted to learn, but what fit the project the best.
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/
Thoughts
These are generally my thoughts on a web page or some sort of url, except a
rare few donāt have a link. These are dual published off of my
thoughts.waylonwalker.com [1] site. Itās a
fully dynamically rendered site 2000ās style. Posts are stored in a database
and instantly available. Almost all of the posts were written in a small
<textarea> field within a chrome extension that I built for it.
These posts are intended to in two ways. One, link building for the author. I
hope that I give the people helping me out along the way just a little bit of a
boost. Two, they serve as a permanant commented bookmark for me to search, and
come back to later when I have forgotten where I have seen something.
- web [2]
- rss [3]
All thoughts posts cross posted to my site are prefixed with a thought balloon š.
The tech # [4]
Since this blog is mostly a tech blog about software development, and my
journey as I learn, lets talk tech.
- python
- fastapi [5]
- htmx [6]
- sqlite
- docker
- ht...
Iām impressed by til [1] from jbranchaud [2].
š Today I Learned
References:
[1]: https://github.com/jbranchaud/til
[2]: https://github.com/jbranchaud
I came across Hexa [1] from wyattbubbylee [2], and itās packed with great features and ideas.
Hexa is a game engine
References:
[1]: https://github.com/wyattbubbylee/Hexa
[2]: https://github.com/wyattbubbylee
Some Git poll results
Some Git poll results
Julia Evans Ā· jvns.ca [1]
great poll of git [2] questions
poll: did you know that in a git merge conflict, the order of the code is different when you do a merge/rebase?
merge:
<<<<<<< HEAD
YOUR CODE
OTHER BRANCHāS CODE
c694cf8aabe
rebase:
«««< HEAD
OTHER BRANCHāS CODE
YOUR CODE
d945752 (your commit message)
This one explains a lot. I think I knew this, I might have seen it somewhere, but I have definitely noticed it go both ways and confuse the crap out of me. Feels very similar to how --ours and --theirs flip flops.
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://jvns.ca/blog/2024/03/28/git-poll-results/
[2]: /glossary/git/
[3]: /thoughts/
External Link
sealed-secrets.netlify.app [1]
kubeseal is a pretty simple to get started with way to manage secrets such that they can be stored in a git [2] repo and be picked up by your continuous delivery service.
Sealed Secrets provides declarative Kubernetes Secret Management in a secure way. Since the Sealed Secrets are encrypted, they can be safely stored in a code repository. This enables an easy to implement GitOps flow that is very popular among the OSS community.
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://sealed-secrets.netlify.app/
[2]: /glossary/git/
[3]: /thoughts/
In my homelab [1] kubernetes cluster I am using kubeseal to encrypt secrets. I
have been using it successfully for a few months now wtih great success. It
allows me to commit all of my secrets manifests to git [2] with out risk of leaking
secrets.
You see kubeseal encrypts your secrets with a private key only stored in your
cluster, so only the cluster itself can decrypt them using the kubeseal
controller.
[3]
KubeSeal # [4]
https://sealed-secrets.netlify.app/
[5]
installation # [6]
Installation happens in two steps. You need the kubernetes controller and the
client side cli to create a sealed secret.
For a more complete instruction see the
[docs#installation](https://github.com/bitnami-labs/sealed-secrets?tab=readme-ov-file#installation]
installation - controller # [7]
Warning
**context**
Make sure that you are in the right context before running any kubectl commands.
kubectl config current-context
sealed-secrets is installed using the helm package manager. To install
sealed-secrets run the following command.
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
helm install sealed-secrets -n kube-system --set-string fullnameOverride=sealed-...
Just starred codemirror-codeium [1] by val-town [2]. Itās an exciting project with a lot to offer.
Codeium code completion integration for CodeMirror 6
References:
[1]: https://github.com/val-town/codemirror-codeium
[2]: https://github.com/val-town
-
Great episode covering a seemingly simple topic. What I really benefitted from was hearing all the different use cases, from logging, debugging, to a/b testing, caching, and auth. I hadnāt even thought of it being applied to a router. I thought of it being applied for an entire application. This seems very useful for things like an admin router, all routes would need to have the admin role to get in.
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/
![[None]]
Iāve been using these decorators to modify the behavior of specific routes. It will do things like 404 admin only routes in a way that looks just like fastapi [1]ās default, or only allow certain roles into the route, or redirect unauthenticated users to login.
After listening to yesterdayās syntaxfm Iām now really thinking about middleware and the benefits it might have. middleware would make it easy to apply things like admin to an entire admin router, so you wont forget it on any one admin route. It will look cleaner as the admin checker is only applied once per router, not once per route.
import inspect
import time
from functools import wraps
from inspect import signature
from fastapi import Request
from fastapi.responses import FileResponse, JSONResponse, RedirectResponse
from starlette import status
from fokais.config import get_config
from fokais.models.user import Role
config = get_config()
admin_routes = []
authenticated_routes = []
not_cached_routes = []
cached_routes = []
def not_found(request):
hx_request_header = request.headers.get("hx-request")
user_agent = request.headers.get("user-agent", "").lower()
if "mozilla" in user_agent or "webkit" i...
kubernetes 6 months in
I stumbled into kubernetes December 2023 when I was looking for a better way
to self host [1] applications. I was looking for something that didnāt require
logging into a server and building and deploying like a cave man. I wanted a
smoother experience than docker compose was giving me.
https://waylonwalker.com/looking-for-a-heroku-replacement/
This post turned into a list of tools that I have adopted into my k8s workflow,
and plan to keep. enjoy.
Kompose # [2]
[3]
Kompose is a great tool for gettting going and converting your docker-compose
to kubernetes manifests or helm templates. It was a great tool for me to get
started with, but I was afraid that it was hindering me learning more and just
blindly using its output so I have tried to use it less and less. Iām now not
solely leaning on it, but using it to get out quick POCs with low friction.
Kompose really helped me go 0 to 60 and get right into kubernetes with my
existing docker compose files and very little change. I fou...
External Link
X (formerly Twitter) Ā· twitter.com [1]
Huh, so this is just built right into the chrome cli.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--headless \
--screenshot=/tmp/shot1.png \
https://simonwillison.net
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://twitter.com/simonw/status/1772043579231445366
[2]: /thoughts/
![[None]]
jinjaās url_for in fastapi [1] does not account for https by default, there is
probably a better way, but this is a way that allows me to configure when I use
http vs https.
@pass_context
def https_url_for(context: dict, name: str, **path_params: Any) -> str:
"""
always convert http to https
"""
request = context["request"]
http_url = request.url_for(name, **path_params)
return str(http_url).replace("http", "https", 1)
def get_templates(config: BaseSettings) -> Jinja2Templates:
templates = Jinja2Templates(directory="templates")
templates.env.globals["https_url_for"] = https_url_for
## only use the default url_for for local development, for dev, qa, and prod use https
if os.environ.get("ENV") in ["dev", "qa", "prod"]:
templates.env.globals["url_for"] = https_url_for
console.print("Using HTTPS")
else:
console.print("Using HTTP")
return templates
Note
This post is a thought [2]. Itās a short note that I make
about someone elseās content online #thoughts
References:
[1]: /fastapi/
[2]: /thoughts/
External Link
X (formerly Twitter) Ā· twitter.com [1]
Damn are one time paid and have it apps making a comeback? Seems like the perfect thing to have someone else automate and not pay a subscription for.
Genius Idea Cassidy!!
Now what do you call this, its not software as a service, is this just sofware?
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://twitter.com/cassidoo/status/1770900985382138291
[2]: /thoughts/
![[None]]
import logging
from typing import List
import strawberry
from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
logger = logging.getLogger(__name__)
authors = {}
books = {}
book_authors = {}
authors_books = {}
def get_author_for_book(root) -> "Author":
return authors[book_authors[root.id]]
@strawberry.type
class Book:
id: int
title: str
author: "Author" = strawberry.field(resolver=get_author_for_book)
def get_books_for_author(root) -> List[Book]:
print(f"getting books for {root}")
return [books[i] for i in authors_books[root.id]]
@strawberry.type
class Author:
id: int
name: str
books: List[Book] = strawberry.field(resolver=get_books_for_author)
authors = {1: Author(id=1, name="Michael Crichton")}
books = {1: Book(id=1, title="Jurassic Park")}
# relationships
book_authors[1] = 1
authors_books[1] = [1]
def get_author_by_id(id: int) -> Author:
return authors.get(id)
def get_book_by_id(id: int) -> Book:
return books.get(id)
def get_authors(root) -> List[Author]:
return authors.values()
def get_books(root) -> List[Book]:
print(books)
print(authors)
print(book_authors)
print(authors_books)
return books.values()
@strawberry.typ...
Joining the split keyboards club: a Moonlander story | Carlos Becker
This post will describe my experience with a couple of firsts:
carlosbecker.com [1]
I switched from a 60% vortex pok3r to a 40% corne June, 2021. I can relate to a lot of what Carlos talks about here. I think going from 60%-40% made my journey harder than it needed to be. Thereās no going back now, but it took me a really long time to be able to hit all of the numbers and symbols, just figuring out how to do the layout was hard thereās not much space.
I didnāt touch type. I never really used my pinkies, except maybe for ESC, Shift, CTRL, Backspace et al.
I can relate to this, my typing habits were terrible. Shortly before going split ortho I worked on my speed with lots, and lots of practice on keybr and monkeytype. I took my speed from 35wpm to 80wpm with a few months of steady practice. This is one of the best things I did for myself.
Once I got split it dropped down to single digits and slowly rose back up to 80, just barely breaking my PB on monkeytype.
I still feel like I still canāt type at my previous max speed ā mostly because I wasnāt used to use my pinky and used the āwrong fingerā for a lot of...
My workflow, part 1 | Carlos Becker
I keep getting asked how my setup works, how I use tmux and
nvim over ssh⦠all that good stuff.
carlosbecker.com [1]
Carlos has a pretty sick setup here, I can relate to mostly, cept the macos part. My main critique is that I donāt think he gave window managers much chance on linux, and they just donāt work on MacOS/Windows.
Most of the time I have a single, maximized window.
I can relate to this. I should really make a full post about my experience with tiling window managers. TLDR, I came for tiling and I stayed for the workspaces.
Multiple Displays
An exception here could be streaming: having multiple displays can help preventing doxing yourself if you only share the screen of one of them. I only did stream like 3 times and thatās what I did, but Iām sure experienced streamers have better workflows (with or without multiple displays).
Accurate, my home machine uses one monitor, and for work I use one monitor+laptop. I pair, screenshare, and present quite a bit at work, and its good to have one screen for sharing, and one for seeing things like the app you are sharing from (chat, cams, etc)
Note
This post is a thought [2]. Itās a sh...
strawberry-sqlalchemy [1] by strawberry-graphql [2] is a game-changer in its space. Excited to see how it evolves.
A SQLAlchemy Integration for strawberry-graphql
References:
[1]: https://github.com/strawberry-graphql/strawberry-sqlalchemy
[2]: https://github.com/strawberry-graphql
I recently discovered AnyText [1] by tyxsspa [2], and itās truly impressive.
Official implementation code of the paper <AnyText: Multilingual Visual Text Generation And Editing>
References:
[1]: https://github.com/tyxsspa/AnyText
[2]: https://github.com/tyxsspa