Archive

All published posts

2501 posts latest post 2026-06-21 simple view
Publishing rhythm
May 2026 | 56 posts
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. References: [1]: https://stripe.com/docs/billing/subscriptions/cancel#canceling

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 and sqlmodel on sqlite. My billing integration is going to be all Stripe.

Stripe Subscription Cancellations Docs #

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.

Cancel subscriptions | Stripe Documentation

User Model #

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_subscriptions:
            stripe.Subscription.modify(
                subscription.id,
                cancel_at_period_end=True,
            )
        self.refresh()

    def reactivate_subscription(self):
        for subscription in self.active_subscriptions:
            stripe.Subscription.modify(
                subscription.id,
                cancel_at_period_end=False,
            )
        self.refresh()

Cancellations api #

Here is the cancellations api. I created an are you sure form that I can link to from the accounts page with a normal anchor tag. Note that I am doing a POST request to do the cancellation from a form. I want this to work for any user whether there is js or not. This is an operation that will change the users data, and I want to make sure that it avoids all browser and cdn caching. As a scrappy startup we are running light on infrastructure and are caching hard at the CDN to avoid excessive server hits.

Note

 I am doing a `POST` request to do the cancellation from a form.
@pricing_router.get("/cancel")
@pricing_router.get("/cancel/")
def get_cancel(
    request: Request,
    current_user: Annotated[User, Depends(get_current_user_if_logged_in)],
):
    return config.templates.TemplateResponse(
        "cancel.html",
        {
            "request": request,
            "prices": products.prices,
            "products": products.products,
            "current_user": current_user,
        },
    )


@pricing_router.post("/cancel")
@pricing_router.post("/cancel/")
def post_cancel(
    request: Request,
    current_user: Annotated[User, Depends(get_current_user_if_logged_in)],
):
    current_user.cancel_subscription()
    return HTMLResponse('<p id="cancel" hx-swap-oob="outerHTML">Your Subscription has been Cancelled</p>')

Reactivations #

Reactivating accounts looks just about the same as cancelling, only flippng True to False.


@pricing_router.get("/reactivate")
@pricing_router.get("/reactivate/")
def get_reactivate(
    request: Request,
    current_user: Annotated[User, Depends(get_current_user_if_logged_in)],
):
    return config.templates.TemplateResponse(
        "reactivate.html",
        {
            "request": request,
            "prices": products.prices,
            "products": products.products,
            "current_user": current_user,
        },
    )


@pricing_router.post("/reactivate")
@pricing_router.post("/reactivate/")
def post_reactivate(
    request: Request,
    current_user: Annotated[User, Depends(get_current_user_if_logged_in)],
):
    current_user.reactivate_subscription()
    return HTMLResponse('<p id="reactivate" hx-swap-oob="outerHTML">Your Subscription has been reactivated</p>')

Full User Model #

This is the full user model, completely subject to change in the future, but it includes the cancel and reactivate methods.

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]

    @property
    def session(self):
        return next(get_session())

    @classmethod
    def get_by_id(cls, id):
        return next(get_session()).get(cls, id)

    def refresh(self):
        cache.set(f"active_subscriptions_{self.id}", None, 3600)
        cache.set(f"active_products_{self.id}", None, 3600)

    def get_checkout_sessions(self):
        return [
            stripe.checkout.Session.retrieve(s.stripe_checkout_session_id)
            for s in self.session.exec(select(CheckoutSession).where(CheckoutSession.user_id == self.id)).all()
            if s.stripe_checkout_session_id is not None
        ]

    def get_active_subscriptions(self):
        subscriptions = [
            s.subscription
            for s in [
                stripe.checkout.Session.retrieve(s.stripe_checkout_session_id)
                for s in self.session.exec(select(CheckoutSession).where(CheckoutSession.user_id == self.id)).all()
                if s.stripe_checkout_session_id is not None
            ]
            if s.status == "complete"
        ]
        active_subscriptions = [stripe.Subscription.retrieve(subscription) for subscription in subscriptions]
        return active_subscriptions

    def has_active_subscription(self):
        return len(self.active_subscriptions) > 0

    @property
    def active_subscriptions(self):
        active_subscriptions = cache.get(f"active_subscriptions_{self.id}")
        if active_subscriptions is not None:
            return active_subscriptions
        active_subscriptions = self.get_active_subscriptions()
        cache.set(f"active_subscriptions_{self.id}", active_subscriptions, 3600)

        return active_subscriptions

    @property
    def active_plans(self):
        subscriptions = self.active_subscriptions
        plans = [subscription.plan for subscription in subscriptions]
        return plans

    @property
    def subscription_to_plan(self):
        subscriptions = self.active_subscriptions
        plans = {subscription.id: subscription.plan.id for subscription in subscriptions}
        return plans

    @property
    def plan_to_subscription(self):
        plans = {v: k for k, v in self.subscription_to_plan.items()}

        return plans

    def get_active_products(self):
        plans = self.active_plans
        products = [stripe.Product.retrieve(plan.product) for plan in plans]
        return products

    @property
    def plan_to_product(self):
        plans = self.active_plans
        products = {plan.id: stripe.Product.retrieve(plan.product).id for plan in plans}
        return products

    @property
    def prodct_to_plan(self):
        plans = self.active_plans
        products = {stripe.Product.retrieve(plan.product).id: plan.id for plan in plans}
        return products

    @property
    def active_products(self):
        products = cache.get(f"active_products_{self.id}")
        if products is not None:
            return products
        products = self.get_active_products()
        cache.set(f"active_products_{self.id}", products, 3600)

        return products

    @property
    def best_active_subscription(self):
        subscriptions = self.active_subscriptions
        return subscriptions[0]

    @property
    def best_active_product(self):
        products = self.active_products
        products.sort(key=lambda p: p.metadata.get('level', 0))
        return products[0]

    @property
    def best_active_subscription(self):
        subscription_id = self.plan_to_subscription[self.prodct_to_plan[self.best_active_product.id]]
        return stripe.Subscription.retrieve(subscription_id)

    @property
    def config(self):
        product = self.best_active_product
        return product.metadata

    def subscription_status(self):
        subscriptions = self.active_subscriptions()

    def cancel_subscription(self):
        for subscription in self.active_subscriptions:
            stripe.Subscription.modify(
                subscription.id,
                cancel_at_period_end=True,
            )
        self.refresh()

    def reactivate_subscription(self):
        for subscription in self.active_subscriptions:
            stripe.Subscription.modify(
                subscription.id,
                cancel_at_period_end=False,
            )
        self.refresh()
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 References: [1]: https://stripe.com/docs/api/invoices/upcoming
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'") References: [1]: https://stripe.com/docs/search#search-query-language
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.

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 #

A few months back in september of 2023 I made a case for tailwindcss. 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 #

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.

screenshot of https://fokais.com

htmx">HTMX #

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, and all I need to do is add classes to my component.

Heres a sample component for a user widget that will go on every page. It has everything it needs right in the template.

<div
  hx-swap-oob="outerHTML"
  id="user-header"
  class="absolute top-0 right-0 mt-8 mr-4"
>

<!--markata-attribution-->
  {% if current_user %}

<!--markata-attribution-->
  <details

<!--markata-attribution-->
    id="user-header-details"

<!--markata-attribution-->
    open
    class="group list-none px-4 py-2 self-center justify-self-center bg-neutral-600/10 shadow-lg shadow-zinc-950/20 ring-2 ring-zinc-950/5 rounded-xl flex justify-center align-center flex-col"
  >
    <summary style="list-style-type: none">{{ current_user.username }}</summary>

<!--markata-attribution-->
    <div class="hidden group-hover:block my-4">

<!--markata-attribution-->
      <a
        class="mt-6 px-4 py-2 rounded bg-purple-950/5 ring-2 ring-cyan-500/30 text-cyan-500 font-bold"

<!--markata-attribution-->
        href="{{ url_for('get_logout') }}"
      >

<!--markata-attribution-->
        Logout
      </a>

<!--markata-attribution-->
    </div>

<!--markata-attribution-->
  </details>

  {% else %}
  <a
    href="{{ url_for('post_login') }}"
    class="mt-5 text-xl text-white font-bold text-shadow-xl text-shadow-zinc-950"
  >

<!--markata-attribution-->
    login
  </a>

<!--markata-attribution-->
  {% endif %}

<!--markata-attribution-->
</div>

internal apps #

I’ve built several interal apps, and tailwind has been really great for this. Its super quick to pop classes on components and get things to look decent quickly, or put some real polish into making them look nice.

My Website waylonwalker.com #

I’ve dropped my old decrepid css for some tailwind on my main site. My css was much smaller, but did not work quite as well on all devices, and most importantly was becoming a house of cards. Every time I fixed one thing several other things would fail. Colors were a bit muddy, and not as nicely configured as tailwind.

Most importantly was becoming a house of cards. Every time I fixed one thing several other things would fail.

One rough side of styling a blog in tailwind is that you don’t necessarily have control over granular details of how your pages get rendered without getting really deep into the markdown renderer, or writing your posts in html. It ends up looking a bit ugly, and is against the tailwind best practices, but it seems like the best way for a site like this.

@tailwind base;
@tailwind components;
@tailwind utilities;
@import "./highlight.css";

.social {
  @apply font-bold;
  @apply flex flex-row;
  @apply gap-4;
  @apply justify-center;
  @apply py-8;
}

#posts ul ul {
  @apply backdrop-blur-sm;
  @apply flex flex-col sm:grid grid-flow-row-dense;
  @apply gap-4;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  @apply p-4;
}

grid #

I’ve struggled to use grid on my projects, and I’ve tried a few different times with no real success or adoption, but started using it on my resume, to have a main middle column, with two outer full bleed columns where I can make some elements full bleed to the edge. tailwind made this easy, once done, I had an admonition that was beautiful full bleed with a touch of color.

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; } References: [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-after
Go by Example gobyexample.com [1] Fantastic resource for learning go. You work through small examples quickly, learning single concepts along the way. References: [1]: https://gobyexample.com/
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. References: [1]: https://syntax.fm/show/696/how-to-build-a-website-or-app [2]: /html/
[1]@willmcgugan [1]) on X — Just a wee thing that came up today. I think this is kind of neat. https://t.co/Un8FRz2TSJ" loading="lazy"> Will McGugan (@willmcgugan [2]) on X Just a wee thing that came up today. I think this is kind of neat. https://t.co/Un8FRz2TSJ X (formerly Twitter) · twitter.com Textual is so sick, Will just made a live markdown editor in the terminal! References: [1]: https://twitter.com/willmcgugan/status/1729158038551220477 [2]: https://willmcgugan.github.io
[1]https://t.co/YWi0i665VO" [1] loading=“lazy”> Sebastián Ramírez (@tiangolo) on X Now @FastAPI [2] has 65k+ GitHub stars! ✨🎉 Since today, FastAPI has a few more GitHub stars than Flask. 🤯 Now FastAPI is the second most starred Python web framework, right after Django. 🥈… X (formerly Twitter) · twitter.com Fastapi passes flask in GitHub stars! [1] References: [1]: https://twitter.com/tiangolo/status/1729153717956715007 [2]: /fastapi/
- Nice take by @t3dotgg [1]. Some of the old patterns that go deep into webdev, MVC, separation of concerns, REST, are things we are told to believe on day one, thrown so many things, no mental bandwidth, or experience to form our own opinions we must take them as fact. Rarely do we take these facts and revisit them with our new understandings years later. References: [1]: https://twitter.com/t3dotgg
DoomponyLewis 🦄 (@DoomponyLewis) on X @wtravishubbard Management is abhorrent to me X (formerly Twitter) · twitter.com [1] Today I learned the meaning of abhorrent abhorrent ăb-hôr′ənt, -hŏr′- adjective Disgusting, loathsome, or repellent. Feeling repugnance or loathing. References: [1]: https://twitter.com/pypeaday/status/1727156823185113304
I’m really excited about sqlmodel [1], an amazing project by fastapi [2]. It’s worth exploring! SQL databases in Python, designed for simplicity, compatibility, and robustness. References: [1]: https://github.com/fastapi/sqlmodel [2]: https://github.com/fastapi
If you’re into interesting projects, don’t miss out on draw-a-ui [1], created by SawyerHood [2]. Draw a mockup and generate html [3] for it References: [1]: https://github.com/SawyerHood/draw-a-ui [2]: https://github.com/SawyerHood [3]: /html/
Heroicons Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS. Heroicons · heroicons.com [1] heroicons is a really nice set of many of the basic icons that you will need for building nice ui’s. They have a really nice copy as svg or jsx button, so that you can just yank it and paste it on your page without any extra packages or installation. References: [1]: https://heroicons.com/
Uptime Kuma A self-hosted monitoring tool uptime.kuma.pet [1] Uptime kuma is a fantastic self hosted [2] monitoring tool. One docker run command and you are up and running. Once you are in you have full control over checking status of urls, frequency, allowed timeouts, and a HUGE list of notification providers docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1 I deployed it in my homelab [3] today. [4] References: [1]: https://uptime.kuma.pet/ [2]: /self-host/ [3]: /homelab/ [4]: https://twitter.com/_WaylonWalker/status/1723077941649707468
I came across uptime-kuma [1] from louislam [2], and it’s packed with great features and ideas. A fancy self-hosted [3] monitoring tool References: [1]: https://github.com/louislam/uptime-kuma [2]: https://github.com/louislam [3]: /self-host/
kv - Command | Vault | HashiCorp Developer The "kv" command groups subcommands for interacting with Vault's key/value secret engine. kv - Command | Vault | HashiCorp Developer · developer.hashicorp.com [1] hashi vault lets you manage secrets right from your cli. # set your vault url export VAULT_ADDR=https://myvault.mydomain vault login # get a secret vault kv get secret/hvac # put a secret vault kv put -mount=secret creds passcode=my-long-passcode # get it vault kv get secret/creds # == Secret Path == # secret/data/creds # # ======= Metadata ======= # Key Value # --- ----- # created_time 2023-11-05T02:53:40.978120001Z # custom_metadata <nil> # deletion_time n/a # destroyed false # version 3 # # ====== Data ====== # Key Value # --- ----- # bar baz # passcode my-long-passcode # get one field vault kv get -field=passcode secret/creds # my-long-passcode vault kv put -mount=secret creds bar=baz # set more keys vault kv put -mount=secret creds passcode=my-long-passcode bar=baz # # == Secret Path == # secret/data/creds # # ======= Metadata ======= # Key Value # --- ----- # created_time 2023-11-05T03:24:14.65958906Z # custom_metadata <nil> # deletion_time n/a # destroyed fa...
Looking for inspiration? cloudflared [1] by cloudflare [2]. Cloudflare Tunnel client (formerly Argo Tunnel) References: [1]: https://github.com/cloudflare/cloudflared [2]: https://github.com/cloudflare
The work on vhs [1] by charmbracelet [2]. Your CLI home video recorder 📼 References: [1]: https://github.com/charmbracelet/vhs [2]: https://github.com/charmbracelet
Check out Kanaries [1] and their project Rath [2]. Next generation of automated data exploratory analysis and visualization platform. References: [1]: https://github.com/Kanaries [2]: https://github.com/Kanaries/Rath
The work on local-ai-stack [1] by ykhli [2]. A starter kit to build local-only AI apps that cost $0 to run – starting with document Q&A. Written in Javascript References: [1]: https://github.com/ykhli/local-ai-stack [2]: https://github.com/ykhli
I’m impressed by pywebcopy [1] from rajatomar788 [2]. Locally saves webpages to your hard disk with images, css, js & links as is. References: [1]: https://github.com/rajatomar788/pywebcopy [2]: https://github.com/rajatomar788
I’m impressed by fem-htmx [1] from ThePrimeagen [2]. No description available. References: [1]: https://github.com/ThePrimeagen/fem-htmx [2]: https://github.com/ThePrimeagen
Just starred fem-htmx-proj [1] by ThePrimeagen [2]. It’s an exciting project with a lot to offer. No description available. References: [1]: https://github.com/ThePrimeagen/fem-htmx-proj [2]: https://github.com/ThePrimeagen
I’m impressed by stamina [1] from hynek [2]. Production-grade retries for Python References: [1]: https://github.com/hynek/stamina [2]: https://github.com/hynek
GitHub - johanhaleby/kubetail: Bash script to tail Kubernetes logs from multiple pods at the same time Bash script to tail Kubernetes logs from multiple pods at the same time - johanhaleby/kubetail GitHub · github.com [1] Kubetail is a pretty sick bash script that allows you to tail logs for multiple pods in one stream. Very handy when you have more than one replica running. wget https://raw.githubusercontent.com/johanhaleby/kubetail/master/kubetail chmod u+x ./kubetail Now with kubetail I can tail all the logs for every shot-wayl-one pod in the shot namespace. ./kubetail shot-wayl-one -n shot [2] References: [1]: https://github.com/johanhaleby/kubetail [2]: https://screenshots.waylonwalker.com/kubetail.png
I’m impressed by kubetail [1] from johanhaleby [2]. Bash script to tail Kubernetes logs from multiple pods at the same time References: [1]: https://github.com/johanhaleby/kubetail [2]: https://github.com/johanhaleby
- I am converting my docker compose env secrets over to k8s secrets. This guide was clear and to the point how I can replicate this exact workflow. First set the secret, the easiest way is to use kubectl wtih –from-literal because it automatically base64 encodes for you. kubectl create secret generic minio-access-key --from-literal=ACCESS_KEY=7FkTV**** -n shot If you don’t use the --from-literal you will have to base64 encode it. echo "7FkTV****" | openssl base64 Once you have your secret deployed, you have to update the container spec in your deployment manifest to get the valueFrom secretKeyRef. spec: containers: - env: - name: ACCESS_KEY valueFrom: secretKeyRef: key: ACCESS_KEY name: minio-access-key - name: SECRET_KEY valueFrom: secretKeyRef: key: SECRET_KEY name: minio-secret-key image: registry.wayl.one/shot-scraper-api name: shot-wayl-one ports: - containerPort: 5000 protocol: TCP resources: {} restartPolicy: Always
waylon walker (@_WaylonWalker) on X Which is more complicated X (formerly Twitter) · twitter.com [1] Wow, shocked at these results. All this time I’ve been told and believed that k8s is incredibly hard, and you need a $1M problem before you think about it because it will take a $1M team to maintain it. So far my experience has been good, and I definitely do not have a $1M problem in my homelab [2]. [1] References: [1]: https://twitter.com/_WaylonWalker/status/1718300097174270193 [2]: /homelab/
[1]https://t.co/bAiTzSWU9o" [1] loading=“lazy”> Wes Bos (@wesbos) on X 🔥 The stale-while-revalidate header is suuuuuuper handy for striking a balance between fast loads and and frequently changed content. Here I am using it to instantly deliver an OG [2] image that t… X (formerly Twitter) · twitter.com Wes has some of the coolest OG images i’ve ever seen. Here he talks about how to enable cache configuration so that its constantly updating the cache without the user waiting for the image to be created. References: [1]: https://twitter.com/wesbos/status/1717923624559005977 [2]: /og/
Looking for inspiration? NeoComposer.nvim [1] by ecthelionvi [2]. Neovim plugin that simplifies macros, enhancing productivity with harmony. References: [1]: https://github.com/ecthelionvi/NeoComposer.nvim [2]: https://github.com/ecthelionvi
htmx ~ Locality of Behaviour (LoB) Carson Gross explores the Locality of Behaviour (LoB) principle, which emphasizes making the behavior of code units obvious on inspection to enhance maintainability. He discusses the tradeoffs betw... htmx.org [1] Interesting principle here. What a great example, If I’m looking at the second jQuery example, I have to dig into dev tools or make some assumtions that this team uses jQuery, and selects by id, therefore I can grep for $("#d1"). Consider two different implementations of an AJAX request in HTML [2], the first in htmx [3]: <!--markata-attribution--> <button hx-get="/clicked">Click Me</button> > and the second in jQuery: ``` js $("#d1").on("click", function(){ $.ajax({ /* AJAX options... */ }); }); <button id="d1">Click Me</button> References: [1]: https://htmx.org/essays/locality-of-behaviour/ [2]: /html/ [3]: /htmx/
External Link thoughts.waylonwalker.com [1] I was looking to add running kubernetes jobs to a python cli I am creating, and I found this solution, mostly thanks to ollama run mistral:7b-instruct-q4_K_M and my loose understanding of what the yaml syntax is supposed to look like for a kubernetes job. This will let me create a job in the cluster, choose the image that runs, the command that is called, and how long until the job expires and is cleaned up. While the job still exists I can go in and look at the logs, but once its ttl has expired they are gone. from kubernetes import client, config # Load the default kubeconfig config.load_kube_config() # Define the API client for batch jobs api_instance = client.BatchV1Api() # Create a new job object job = client.V1Job( api_version="batch/v1", kind="Job", metadata=client.V1ObjectMeta(name="myjob"), spec=client.V1JobSpec( ttl_seconds_after_finished=100, template=client.V1PodTemplateSpec( metadata=client.V1ObjectMeta(labels={"app": "myjob"}), spec=client.V1PodSpec( containers=[ client.V1Container( name="myjobcontainer", image="busybox", command=["ls", "/"], ), ], restart_policy="Never", ), ), backoff_limit=1, )...
Check out kevinhwang91 [1] and their project nvim-ufo [2]. Not UFO in the sky, but an ultra fold in Neovim. References: [1]: https://github.com/kevinhwang91 [2]: https://github.com/kevinhwang91/nvim-ufo
https://neovim.io/doc/user/diagnostic/ neovim.io [1] Clear out lsp diagnostics in nvim. lua vim.diagnostic.reset() References: [1]: https://neovim.io/doc/user/diagnostic.html#vim.diagnostic.reset()
How to kill process based on the port number in Linux Learn to kill a process by port in Linux using fuser, lsof, and ss commands. Essential for system admins managing network processes efficiently. LinuxConfig · linuxconfig.org [1] I’ve often struggled to find and kill a process using a certain port on archlinux. Mainly becuase most guides use netstat rather than ss. Here is how I just killed the process using port 5000 using fuser. sudo fuser -k 5000/tcp You can also get information about the process by running lsof ❯ lsof -i :5000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME thoughts 1058292 waylon 11u IPv4 119622828 0t0 TCP *:commplex-main (LISTEN) References: [1]: https://linuxconfig.org/how-to-kill-process-based-on-the-port-number-in-linux
GitHub - mkimuram/k8sviz: Generate Kubernetes architecture diagrams from the actual state in a namespace Generate Kubernetes architecture diagrams from the actual state in a namespace - mkimuram/k8sviz GitHub · github.com [1] This is a sick kubernetes architecture diagran generation tool. Here is an example [2] installation # [3] $ curl -LO https://raw.githubusercontent.com/mkimuram/k8sviz/master/k8sviz.sh $ chmod u+x k8sviz.sh Usage # [4] ./k8sviz.sh --kubeconfig ~/.config/kube/falcon-k3s.yaml -t png -o k8sviz.png References: [1]: https://github.com/mkimuram/k8sviz [2]: https://raw.githubusercontent.com/mkimuram/k8sviz/master/examples/wordpress/default.png [3]: #installation [4]: #usage
Just starred just [1] by casey [2]. It’s an exciting project with a lot to offer. 🤖 Just a command runner References: [1]: https://github.com/casey/just [2]: https://github.com/casey
GitHub - casey/just: 🤖 Just a command runner 🤖 Just a command runner. Contribute to casey/just development by creating an account on GitHub. GitHub · github.com [1] I think just, might just be the thing I have been looking for. I’ve been looking for some ci/cd that I can host myself, but everything looks pretty big, so for now I am going to use just as my task runner. I installed with installer. curl https://i.wayl.one/casey/just | bash I set up my devtainer builds with just. Here is my justfile, yes you just need the cli and a file named justfile. default: base alpine slim base: build deploy alpine: build-alpine deploy-alpine slim: build-slim deploy-slim build: podman build -t registry.wayl.one/devtainer:latest . deploy: podman push registry.wayl.one/devtainer build-alpine: podman build -f docker/Dockerfile.alpine -t registry.wayl.one/devtainer:alpine . deploy-alpine: podman push registry.wayl.one/devtainer:alpine build-slim: podman build -f docker/Dockerfile.slim -t registry.wayl.one/devtainer:slim . deploy-slim: podman push registry.wayl.one/devtainer:slim References: [1]: https://github.com/casey/just
Translate a Docker Compose File to Kubernetes Resources What Kubernetes · kubernetes.io [1] kompose is a sick cli to convert docker-compose.yml to kubernetes manifest. # install curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.0/kompose-linux-amd64 -o kompose kompose convert kompose convert -o deployment.yaml References: [1]: https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/
[1] Running your own docker registry in one line podman run -d -p 5000:5000 --restart=always --name registry registry:latest References: [1]: /static/https://blog.nashcom.de/nashcomblog.nsf/dx/k3s-podman-and-a-registry.htm