Archive

All published posts

2507 posts latest post 2026-05-29
Publishing rhythm
May 2026 | 54 posts
- I’ve heard prime say just give it the one eyed fighting kirby so many times, and execute it few times, and there is no way to find it online, so this will be the link that I will come to, when I need to remember what @theprimeagen means when he says Give it the one eyed fighting kirby. :s/\(.*\);/console.log(\1) So what is this? # [1] This is a vim substitute comand to replace text in the buffer. the one eyed fighting kirby is a regex capture group to capture everything between matches, and assign it a value to place back in after the match. substitute in a nutshell, :s/<what you want to replace>/<what you want to replace with> More examples # [2] Here is a contrived example of text. here there from here go there here = some_fuction(there) Now for some reason I want to switch all of the words here and there. I can do that with three capture groups, \1 is here, \2 is everything between, \3 is there. :%s/\(here\)\(.*\)\(there\)/\3\2\1 Just give it the one eyed fighting kirby ~Prime still struggling # [3] I thought this explaination from phind was good and more verbose than mine. --- describe this vim substitute regex :%s/(here)(.)(there)/\3\2\1 ANSWER | PHIND V9 M...
Java - ArchWiki wiki.archlinux.org [1] Today I learned that arch has a helper script archlinux-java to set the version of java. archlinux-java status archlinux-java set <JAVA_ENV_NAME> 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://wiki.archlinux.org/title/java#Switching_between_JVM [2]: /thoughts/
GitHub - charmbracelet/mods: AI on the command line AI on the command line. Contribute to charmbracelet/mods development by creating an account on GitHub. GitHub Ā· github.com [1] This is a pretty sweet interface into llms. I used it a bit with my son tonight while he was asking me for datapack ideas. āÆ mods -f 'I am trying to have fun on my minecraft server and am creating a minecraft datapack send me some load.mcfuncions that will make it fun' You can continue the conversation with a -C āÆ mods -C -f 'I like where you are going with number 4, can you make it so that it runs when a player opens a door' You can pass it some data curl https://waylonwalker.com/thoughts-on-unit-tests/ | mods -f 'summarize this 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://github.com/charmbracelet/mods [2]: /thoughts/
GitHub - charmbracelet/mods: AI on the command line AI on the command line. Contribute to charmbracelet/mods development by creating an account on GitHub. GitHub Ā· github.com [1] This is a pretty sweet interface into llms. I used it a bit with my son tonight while he was asking me for datapack ideas. āÆ mods -f 'I am trying to have fun on my minecraft server and am creating a minecraft datapack send me some load.mcfuncions that will make it fun' You can continue the conversation with a -C āÆ mods -C -f 'I like where you are going with number 4, can you make it so that it runs when a player opens a door' !!! note This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make about someone else's content online #thoughts References: [1]: https://github.com/charmbracelet/mods
The work on mods [1] by charmbracelet [2]. AI on the command line References: [1]: https://github.com/charmbracelet/mods [2]: https://github.com/charmbracelet
Gridfinity The modular, open-source grid storage system. Gridfinity Ā· gridfinity.xyz [1] I am starting to build out some custom tool holders for my tool box, and using gridfinity. This is a super handy reference guide for spec’ing out the bases. 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://gridfinity.xyz/specification/ [2]: /thoughts/
Read a Range of Data - LIMIT and OFFSET - SQLModel SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. sqlmodel.tiangolo.com [1] Today I was running some sqlmodel queries through the sqlalchemy orm. Admittedly I’ve not done enough orm queries before, and I’ve done quite a bit of raw sql. I was trying to get objects from two separate models that had relationships setup. session.query(User, Images).where(User.id == 3).all() It is incredibly slow, and gives me the following warning. SELECT statement has a cartesian product between FROM element(s) What I learned from the SQLModel docs is that you should give it a join to correct this and go much faster. session.query(User, Images).join(Images).where(User.id == 3).all() 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/limit-and-offset/ [2]: /thoughts/
So after months of fighting with gf not going to template files, I finally decided to put in some effort to make it work. This was the dumbest keybind in my config, that I copied from someone else without understanding it. What I am trying to do # [1] I have jinja templates in a directory called templates. I want to bind gf to open a template file, but it is trying to open a new file ./base.html {% extends "base.html" %} {% if request.state.user %} {% block title %}Fokais - {{ request.state.user.full_name }} {% endblock %} {% else %} {% block title %}Fokais {% endblock %} {% endif %} {% block content %} {% if request.state.user %} <h1 id="title" class="inline-block mx-auto text-5xl font-black leading-loose text-transparent bg-clip-text bg-gradient-to-r from-red-600 via-pink-500 to-yellow-400 ring-red-500 text-shadow-xl text-shadow-zinc-950 ring-5"> {{ request.state.user.full_name }} </h1> {% endif %} {% include "me_partial.html" %} {% endblock %} What did not work # [2] I tried all sorts of changes to my path, but it still didn’t work. vim.api.nvim_command("set path+=templates/**") What I found # [3] after digging into my keymap I found that I had remaped gf ...
vim
Template Designer Documentation — Jinja Documentation (3.1.x) jinja.palletsprojects.com [1] html [2] code generated by my jinja templates generally look half garbage because of indents and whitespace all over the place. I just learned about these pesky Whitespace Control characters that can get rid of the whitespace added from templating. You can also strip whitespace in templates by hand. If you add a minus sign (-) to the start or end of a block (e.g. a For tag), a comment, or a variable expression, the whitespaces before or after that block will be removed: {% for item in seq -%} {{ item }} {%- endfor %} 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://jinja.palletsprojects.com/en/3.0.x/templates/#whitespace-control [2]: /html/ [3]: /thoughts/
Intro - Minecraft Server on Docker (Java Edition) Documentation for Minecraft Server on Docker docker-minecraft-server.readthedocs.io [1] I just learned that if you can exec into the container running minecraft with the itzg/minecraft container you can run rcon-cli to get command access to the server. You need to set the RCON_PASSWORD if you want to access rcon remotely, but if you have not already done this and have access to the server you can just run rcon-cli when you are in. 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://docker-minecraft-server.readthedocs.io/en/latest/ [2]: /thoughts/
- Theo’s response puts a lot of my feelings about unit testing into words. It’s crazy how cargo culty it becomes that the echo chamber of twitter can bring in beliefs that we think we believe, but have not experienced enough or put enough thought in to form our own opinion. This video made me think so much that it turned into it’s own blog post Thoughts on Unit Testing [1] 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://waylonwalker.com/thoughts-on-unit-tests [2]: /thoughts/

thoughts on unit tests

[1] Your browser does not support the audio element. Theo’s response puts a lot of my feelings about unit testing into words. Many of us have grown up in this world preaching unit testing. We often hear these statements ā€œEverything must be unit tested, tests make code more maintainable.ā€ In reality when we are not writing complex low level code unit tests are probably the wrong approach. [2] Most of us are assemblers # [3] So much of software engineering is assembling existing well tested code. Crud applications, UI, Data Pipelines, building on top of battle tested code. Manufacturing Analogy - Unit Testing # [4] This kind of reminds me of Manufacturing. Individual components are QA tested with tests that look more like unit test. Parts like bearings, pistons, shafts, valves, they are all tested against sophisticated statistics of sample measurements. This is quite similar to unit testing. [5] You see measuring the individual sizes of these components does not guarantee ...
5 min read
Mastodon.py — Mastodon.py 2.2.1 documentation mastodonpy.readthedocs.io [1] Mastadon.py is a python api client for mastadon that makes it easy to cross post to mastadon. from mastodon import Mastodon Mastodon.create_app( 'pytooterapp', api_base_url = 'https://mastodon.social', to_file = 'pytooter_clientcred.secret' ) from mastodon import Mastodon mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',) mastodon.log_in( '[email protected]', 'incrediblygoodpassword', to_file = 'pytooter_usercred.secret' ) mastodon.toot('Tooting from Python using #mastodonpy !') 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://mastodonpy.readthedocs.io/en/stable/ [2]: /thoughts/
bunny.net - The Global Edge Platform that truly Hops Hop on bunny.net and speed up your web presence with the next-generation Content Delivery Service (CDN), Edge Storage, and Optimization Services at any scale. bunny.net Ā· bunny.net [1] bunny.net looks like an interesting cloudflare alternative. 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://bunny.net/ [2]: /thoughts/
IndieWebify.Me - a guide to getting you on the IndieWeb indiewebify.me [1] This is a sick guided site to validate indieweb tags on your site. It makes it much easier than trying to do it yourself. 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://indiewebify.me/ [2]: /thoughts/
I came across nvim-macroni [1] from jesseleite [2], and it’s packed with great features and ideas. 🤌 Save your macros for future use References: [1]: https://github.com/jesseleite/nvim-macroni [2]: https://github.com/jesseleite
jesseleite [1] has done a fantastic job with macroni.nvim [2]. Highly recommend taking a look. Save your macros for future use 🤌 References: [1]: https://github.com/jesseleite [2]: https://github.com/jesseleite/macroni.nvim
ikalnytskyi [1] has done a fantastic job with httpie-auth-store [2]. Highly recommend taking a look. Credential store plugin for HTTPie, attaches auth to ongoing request. References: [1]: https://github.com/ikalnytskyi [2]: https://github.com/ikalnytskyi/httpie-auth-store
Authentication from cli tools can be a bit of a bear, and I have to look it up every time. This is my reference guide for future me to remember how to easily do it. I set up a fastapi [1] server running on port 8000, it uses a basic auth with waylonwalker as the username and asdf as the password. The server follows along with what comes out of the docs. I have it setup to take basic auth, form username and password, or a bearer token for authentication. curl # [2] The og [3] of command line url tools. # basic auth curl -u 'waylonwalker:asdf' -X POST localhost:8000/token # basic auth with password prompt curl -u 'waylonwalker' -X POST localhost:8000/token # token curl -H 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3YXlsb253YWxrZXIiLCJleHAiOjE3MDI5NTI2MDJ9.GeYNt7DNal6LTiPoavJnqypaMt4vYeriXdq5lqu1ILg' -X POST localhost:8000/token wget # [4] My go to if I want the result to go into a file. # basic auth wget -q -O - --auth-no-challenge --http-user=waylonwalker --http-password=asdf --post-data '' localhost:8000/token # token wget -q -O - --header="Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3YXlsb253YWxrZXIiLCJleHAiOjE3MDI5NT...
External Link stackoverflow.com [1] After struggling to get dependencies inside of middleware I learned that you can make global dependencies at the app level. I used this to set the user on every single route of the application without needing Depend on getting the user on each route. from fastapi import Depends, FastAPI, Request def get_db_session(): print("Calling 'get_db_session(...)'") return "Some Value" def get_current_user(session=Depends(get_db_session)): print("Calling 'get_current_user(...)'") return session def recalculate_resources(request: Request, current_user=Depends(get_current_user)): print("calling 'recalculate_resources(...)'") request.state.foo = current_user app = FastAPI(dependencies=[Depends(recalculate_resources)]) @app.get("/") async def root(request: Request): return {"foo_from_dependency": request.state.foo} 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://stackoverflow.com/questions/72243379/fastapi-dependency-inside-middleware#answer-72480781 [2]: /thoughts/
Handling Errors - FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi.tiangolo.com [1] This page shows how to customize your fastapi [2] 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} 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://fastapi.tiangolo.com/tutorial/handling-errors/ [2]: /fastapi/ [3]: /thoughts/
logs with FastAPI and Uvicorn Ā· Issue #1508 Ā· fastapi/fastapi Hello, Thanks for FastAPI, easy to use in my Python projects ! However, I have an issue with logs. In my Python project, I use : app = FastAPI() uvicorn.run(app, host="0.0.0.0", port=8000) And when... GitHub Ā· github.com [1] Setting an additional log handler to the uvicorn logger for access logs in fastapi [2] was not straightforward, but This post was very helpful. @app.on_event("startup") async def startup_event(): logger = logging.getLogger("uvicorn.access") handler = logging.StreamHandler() handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")) logger.addHandler(handler) 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://github.com/tiangolo/fastapi/issues/1508 [2]: /fastapi/ [3]: /thoughts/
External Link stackoverflow.com [1] Setting tags in your fastapi endpoints will group them in the docs. You can also set some metadata around the tags to get nice descriptions. Here is a full example from the post. from fastapi import FastAPI tags_metadata = [ {"name": "Get Methods", "description": "One other way around"}, {"name": "Post Methods", "description": "Keep doing this"}, {"name": "Delete Methods", "description": "KILL 'EM ALL"}, {"name": "Put Methods", "description": "Boring"}, ] app = FastAPI(openapi_tags=tags_metadata) @app.delete("/items", tags=["Delete Methods"]) @app.put("/items", tags=["Put Methods"]) @app.post("/items", tags=["Post Methods"]) @app.get("/items", tags=["Get Methods"]) async def handle_items(): return 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://stackoverflow.com/questions/63762387/how-to-group-fastapi-endpoints-in-swagger-ui#answer-63762765 [2]: /thoughts/
External Link X (formerly Twitter) Ā· twitter.com [1] Most bloggers on my twitter blog right into a file that goes on git [2]. I kinda expected to have more database folk. I have my blog in markdown on git and the editing experience is top notch. I can just find files edit them in MY EDITOR, push them and I got a post. I am running thoughts in a sqlite database with a fastapi [3] backend, and holy crap the instant nature of posting feels so much better. Both sides have good points. 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/_WaylonWalker/status/1734387536716308693 [2]: /glossary/git/ [3]: /fastapi/ [4]: /thoughts/
Show some equivalent list comprehensions in filter examples Ā· Issue #1068 Ā· pallets/jinja I'm willing to write a pull-request for this, but I just want to see what people think before I write it. So the issue is this. I'm very familiar with python. I'm new to Jinja2. Often I find myself... GitHub Ā· github.com [1] I often want to reach for non existing list comprehensions in jinja 2, Here are a few nice equivalents. a: {{ data | selectattr('x', 'gt', 5) | list }} b: {{ data | map(attribute='c') | list }} c: {{ data | selectattr('x', 'gt', 5) | map(attribute='c') | list }} 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://github.com/pallets/jinja/issues/1068 [2]: /thoughts/
External Link vi.stackexchange.com [1] I fixed my missing macro recording indicator that I lost and was never quite sure why. (because I forgot that I set cmdheight=0). vim.cmd [[ autocmd RecordingEnter * set cmdheight=1 ]] vim.cmd [[ autocmd RecordingLeave * set cmdheight=0 ]] 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://vi.stackexchange.com/questions/39947/nvim-vim-o-cmdheight-0-looses-the-recording-a-macro-messages [2]: /thoughts/
I am working on fokais.com’s signup page, and I want to hide the form input during an htmx [1] request. I was seeing some issues where I was able to prevent spamming the submit button, but was still able to get one extra hit on it. It also felt like nothing was happening while sending the email to the user for verification. Now I get the form to disappear and a spinner to show during the request. HTML # [3] Let’s start off with the form. It uses htmx to submit a post request to the post_request route. Note that there is a spinner in the post_request with the htmx-indicator class. The intent is to hide the spinner until the request is running, and hide all of the form input during the request. <form id="signup-form" hx-swap-oob="outerHTML" class="m-4 mx-auto mb-6 flex w-80 flex-col rounded-lg b p-4 shadow-xlc shadow-cyan-500/10" method="POST" action="{{ url_for('post_signup') }}" hx-post="{{ url_for('post_signup') }}" > <input class="mx-8 mt-6 mb-4 border border-black bg-zinc-900 p-1 text-center focus:bg-zinc-800" type="text" value="{{ full_name }}" name="full_name" placeholder="Full Name" /> {% if full_name_error %} <label class="-mt-6 mb-6 mx-8 text-red-500 ...
GitHub - DataDog/ddqa: Datadog's QA manager for releases of GitHub repositories Datadog's QA manager for releases of GitHub repositories - DataDog/ddqa GitHub Ā· github.com [1] DataDog ddqa is building out a textual app and deploying it with pyapp. They have CI setup to fully build and cross compile their textual tui into github releases that you can just download from their releases page. This is something I am looking at for markata. This would be pretty sweet to be able to make it just work on places like windows. It would also be interesting to try to build a full desktop app with pyapp. 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://github.com/DataDog/ddqa [2]: /thoughts/
Check out ddqa [1] by DataDog [2]. It’s a well-crafted project with great potential. Datadog’s QA manager for releases of GitHub repositories References: [1]: https://github.com/DataDog/ddqa [2]: https://github.com/DataDog
I like cross-rs’s [1] project cross [2]. ā€œZero setupā€ cross compilation and ā€œcross testingā€ of Rust crates References: [1]: https://github.com/cross-rs [2]: https://github.com/cross-rs/cross
If you’re into interesting projects, don’t miss out on pyapp [1], created by ofek [2]. Runtime installer for Python applications References: [1]: https://github.com/ofek/pyapp [2]: https://github.com/ofek
[1] Full list of imagemagick color names. Note This post is a thought [2]. It’s a short note that I make about someone else’s content online #thoughts References: [1]: /static/https://imagemagick.org/script/color.php [2]: /thoughts/
External Link X (formerly Twitter) Ā· twitter.com [1] I’m going to give this trick a shot on my sites, and see how I like it. * { min-width: 0 } Down in the comments @adamwathan [2] goes on to say. Basically every layout overflow bug ever boils down to some flex or grid child needing min-width: 0 šŸ˜„ Oh and @ryanflorence [3] also says in the comments. I … do this. 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/adamwathan/status/1734696245015494711 [2]: https://twitter.com/adamwathan/ [3]: https://twitter.com/ryanflorence [4]: /thoughts/
External Link tushar.lol [1] Nice message by @tusharsadhwani [2]. Write it down. You had to dig deeper than face value at something. Write it down. You had to combine multiple pages of docs. Write it down. Someting was simply not obvious to you at first and it took someone else to give you that ah ha moment. Write it down. You had a small discovery that had a marginal impact on your day. Write it down. A blog does not have to be a Blog, it can be small meaningful posts. There are absolutely no rules. If you think you are going to end up with too many posts, that is a solvable problem, make a search, curate your favorite posts, make multiple feeds. At the end of the day. Write it down. This post itself is a thought, the smallest component to my blogging strategy. Write it down. 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://tushar.lol/post/write-a-blog/ [2]: https://twitter.com/sadhlife [3]: /thoughts/
Path Operation Advanced Configuration - FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi.tiangolo.com [1] Excluding routes from fastapi docs, can be done from the route configuration using `include_in_schema`. This is handy for routes that are not really api based or duplicates. From the Docs # [2] from fastapi import FastAPI app = FastAPI() @app.get("/items/", include_in_schema=False) async def read_items(): return [{"item_id": "Foo"}] trailing slash # [3] I’ve had better luck just routing both naked and trailing slash routes in fastapi [4]. I’ve had api’s deployed as a subroute to a site rather than a subdomain, and the automatic redirect betweens them tended to always get messed up. This is pretty easy fix for the pain is causes just give vim a yyp, and if you don’t want deuplicates in your docs, ignore one. from fastapi import FastAPI app = FastAPI() @app.get("/items") @app.get("/items/", include_in_schema=False) async def read_items(): return [{"item_id": "Foo"}] favicon.ico # [5] Now you do not need to deploy favicons to your api in any way, it is nice to have it in your browser tab, but more importantly ...
Protect API docs behind authentication? Ā· Issue #364 Ā· fastapi/fastapi Basic Question Does FastAPI provide a method for implementing authentication middleware or similar on the docs themselves (e.g. to protect access to /docs and /redoc)? Additional context My company... GitHub Ā· github.com [1] You can protect your fastapi [2] docs behind auth so that not only can certain roles not run certain routes, but they cannot even see the docs at all. This way no one that shouldn’t be poking around can even discover routes they shouldn’t be using. Here is the soluteion provided by @kennylajara [3] from fastapi import FastAPI from fastapi.openapi.docs import get_redoc_html, get_swagger_ui_html from fastapi.openapi.utils import get_openapi import secrets from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import HTTPBasic, HTTPBasicCredentials app = FastAPI( title="FastAPI", version="0.1.0", docs_url=None, redoc_url=None, openapi_url = None, ) security = HTTPBasic() def get_current_username(credentials: HTTPBasicCredentials = Depends(security)): correct_username = secrets.compare_digest(credentials.username, "user") correct_password = secrets...
Looking for inspiration? llmware [1] by llmware-ai [2]. Unified framework for building enterprise RAG pipelines with small, specialized models References: [1]: https://github.com/llmware-ai/llmware [2]: https://github.com/llmware-ai
Cancel subscriptions Cancel subscriptions immediately or at the end of the subscription period with proration options, invoice handling, and automatic cancellation after failed payment attempts. stripe.com [1] This is a handy guide to cancelling stripe subscriptions. # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_51ODvHtB26msLKqCAPBAo1qkBBuIfT5tQBX6YFWCLMsPixIExxITCRVa9tNCIqkdQS8olhR79NYXsFWBPKsM3LbGO00zEcNQfNI" stripe.Subscription.modify( "sub_49ty4767H20z6a", cancel_at_period_end=True, ) You can even inverse it by flipping True to False and re activate the subscription. 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://stripe.com/docs/billing/subscriptions/cancel#canceling [2]: /thoughts/
Today I am working on fokais.com, trying to get to a point where I can launch by workig through stripe integrations. This is my first time using stripe, so there has been quite a bit to learn, and I am probably building in more than I need to before launching, but I am learning, and not in a rush to launch. I am building the fokais backent in python primarilyt with fastapi [1] and sqlmodel on sqlite. My billing integration is going to be all Stripe. Stripe Subscription Cancellations Docs # [2] Here is a link to the stripe docs for your refrence, especially if you want to see how to cancel subscriptions in other languages. They include code samples for many popular languages. [3] User Model # [4] This is the part of the user model that includes the cancel and reactivate methods. It pretty much follows the stripe guide. class UserBase(SQLModel, table=False): # type: ignore[call-arg] username: str = Field(unique=True) full_name: str email: str email_verified: bool = False disabled: bool = False signup_date: Optional[datetime] = Field(default_factory=datetime.utcnow) stripe_customer_id: Optional[str] def cancel_subscription(self): for subscription in self.active_sub...
External Link stripe.com [1] You can find your customers next billing date through the stripe api by using Invoice. and passing in customer, customer_details, subscription, or schedule. import stripe stripe.api_key = "sk_test_51ODvHtB26msLKqCAPBAo1qkBBuIfT5tQBX6YFWCLMsPixIExxITCRVa9tNCIqkdQS8olhR79NYXsFWBPKsM3LbGO00zEcNQfNI" invoice = stripe.Invoice.upcoming(customer="cus_NeZwdNtLEOXuvB") Within the invoice, you can find the next_payment_attempt as a epoch. date = datetime.fromtimestamp(invoice.next_payment_attempt) amount = invoice.amount_due currency = invoice.currency 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://stripe.com/docs/api/invoices/upcoming [2]: /thoughts/
Search Use the search APIs to look up and retrieve objects in your Stripe data. Using search is a faster alternative to paginating through all resources. stripe.com [1] Stripe has it’s own query language for querying data. I’m just getting into using it and it seems pretty good so far. I needed to lookup the price for products. I was able to find prices for my product using the python api as shown below. stripe.Price.search(query="active: 'true' and product: 'prod_P8SfwtxJ45cWE2'") 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://stripe.com/docs/search#search-query-language [2]: /thoughts/
stripe-keys-and-ids.tsv [1] tsv Prefix Description Notes ac_ Platform Client ID Identifier for an auth code/client id. acct_ Account ID Identifier for an Account object. aliacc_ Alipay Account ID Identifier for an Alipay account. ba_ Bank Account ID Identifier for a Bank Account object. btok_ Bank Token ID Identifier for a Bank Token object. card_ Card ID Identifier for a Card object. cbtxn_ Customer Balance Transaction ID Identifier for a Customer Balance Transaction object. ch_ Charge ID Identifier for a Charge object. cn_ Credit Note ID Identifier for a Credit Note object. cs_live_ Live Checkout Session ID Identifier for a checkout Session object in live mode. cs_test_ Test Checkout Session ID Identifier for a checkout Session object in test mode. cus_ Customer ID Identifier for a Customer object. dp_ Dispute ID Identifier for a Dispute object. evt_ Event ID Identifier for an Event object. fee_ Application Fee ID Identifier for an Application Fee object. file_ File ID Identifier for a File object. fr_ Application Fee Refund ID Identifier for an Application Fee Refund object. iauth_ Issuing Authorization ID Identifier for an Issuing Authorization object. ic_ Issuing Card ID ...

Looking for a Heroku replacement, What I found was shocking!

Your browser does not support the audio element. I’ve long hosted my personal blog as a static site on waylonwalker.com. It’s all markdown, converted to html [1], and shipped as is. It’s been great, I’ve moved it from GitHub Pages, to Netlify, tried Vercel for a minute, and have landed on Cloudflare Pages. Each migration has not really been that hard, it’s just pointing ci to a different host after the site has built. [2] What about server side # [3] Now the part that I have struggled with is how to cheaply host a server rendered application that can just live on forever without me paying for it. This is a harder problem as it costs more to keep servers spinning, memory, and disk all ready for you to use at a moments notice. Honestly # [4] I never really deployed anything that useful on heroku, but it seems like the klenex of the bunch that’s why they are in the title. I’ve moved between digital ocean and fly.io, and have had some great experiences with both. I just don’t want...
- Dang this is such a good message. I can’t exactly relate to being forced into the overworking situation that PirateSofware is talking about. I can relate to being conditioned to feeling a certain way and changing that is very difficult. I can also relate to not feeling like I am getting enough done in the day. Sometimes a bit of separation is good. 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/
[1] I’ve been using tailwind for a few months now and I can still say I’m loving it. I’ve been using it to create some rapid prototypes that may or may not ever become something, a document that is likely to go to print (a resume), and some quick dashboards. I started using Tailwind a few month back # [2] A few months back in september of 2023 I made a case for tailwindcss [3]. And have been using it on quite a few projects since. - values are well thought out - it’s really easy to use - classes that make sense - tree shakable fokais.com # [4] I started working on fokais.com only a few weeks ago, It’s going to be a SAS to make blogging easier. I’ve started hosting some tools for this blog that I really like that I think I can turn into a service. It’s been fantastic to quickly pump out new pages with tailwind. [5] HTMX # [7] tailwind and htmx are a match made in heaven. They both really lean on Location of Behavior over Separation of concerns. They do really well at making small components that you can throw on and endpoint and stack into any page. With tailwind I just configure it to look at all my templates, and I can guarantee that the styles will be in app.css, ...
External Link stackoverflow.com [1] Get those print colors exact body{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; } 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://stackoverflow.com/questions/3893986/css-media-print-issues-with-background-color#answer-14784655 [2]: /thoughts/
page-break-after CSS property - CSS | MDN The page-break-after CSS property adjusts page breaks after the current element. MDN Web Docs Ā· developer.mozilla.org [1] I’m working on something that might go to print, so I want the page breaks to happen somewhat in my control as the content author. As I do my writing I break my content up in to many short sections using h2, sometimes an h3. These are generally short sections that go together, should stay together, and typically are not too lengthy to cause a large white space in print. I found a way in css to only allow page breaks to happen on h2 and h3, and it turned out perfect, suck it WSIWIG editors * { page-break-before: avoid; } h2, h3 { page-break-before: auto; } 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://developer.mozilla.org/en-US/docs/Web/CSS/page-break-after [2]: /thoughts/
Go by Example gobyexample.com [1] Fantastic resource for learning go. You work through small examples quickly, learning single concepts along the way. 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://gobyexample.com/ [2]: /thoughts/
How to Build a Website or App - Syntax #696 This podcast episode covers a wide range of topics related to building a website or web application from start to finish. syntax.fm [1] Great tips in this one. They discuss everything from front end to backend, databases and ORMS, here are a few of my favorite points. - Use good data or good fake data - make it have some variation like long and short text - Don’t use a database if you need one, static content is eaiser to manage - end to end test, (does the site load page x) - You DONT NEED all this complexity, you can deploy a site with HTML [2] and CSS. 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://syntax.fm/show/696/how-to-build-a-website-or-app [2]: /html/ [3]: /thoughts/