jesseleite has done a fantastic job with macroni.nvim. Highly recommend taking a look.
Save your macros for future use 🤌
All published posts
jesseleite has done a fantastic job with macroni.nvim. Highly recommend taking a look.
Save your macros for future use 🤌
ikalnytskyi has done a fantastic job with httpie-auth-store. Highly recommend taking a look.
Credential store plugin for HTTPie, attaches auth to ongoing request.
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 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.
The og 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...
...
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.
This page shows how to customize your fastapi 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.
Setting an additional log handler to the uvicorn logger for access logs in fastapi was not straightforward, but This post was very helpful.
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.
Most bloggers on my twitter blog right into a file that goes on git. 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 backend, and holy crap the instant nature of posting feels so much better. Both sides have good points.
I often want to reach for non existing list comprehensions in jinja 2, Here are a few nice equivalents.
I fixed my missing macro recording indicator that I lost and was never quite sure why. (because I forgot that I set cmdheight=0).
I am working on fokais.com’s signup page, and I want to hide the form input during an htmx 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.
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.
...
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.
I like cross-rs’s project cross.
“Zero setup” cross compilation and “cross testing” of Rust crates
Full list of imagemagick color names.
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 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 also says in the comments.
...
Nice message by @tusharsadhwani.
Write it down.
You had to dig deeper than face value at something.
Write it down.
...
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 fastapi import FastAPI app = FastAPI() @app.get("/items/", include_in_schema=False) async def read_items(): return [{"item_id": "Foo"}] I’ve had better luck just routing both naked and trailing slash routes in fastapi. 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.
...
You can protect your fastapi 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
Looking for inspiration? llmware by llmware-ai.
Unified framework for building enterprise RAG pipelines with small, specialized models
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.
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.
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.
This is the part of the user model that includes the cancel and reactivate methods. It pretty much follows the stripe guide.
...
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.
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.
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 Identifier for an Issuing Card object. ich_ Issuing Card Holder ID Identifier for an Issuing Card Holder object. idp_ Issuing Dispute ID Identifier for an Issuing Dispute object. ii_ Invoice Item ID Identifier for an Invoice Item object. il_ Invoice Line Item ID Identifier for a Invoice Line Item object. in_ Invoice ID Identifier for an Invoice object. ipi_ Issuing Transaction ID Identifier for an Issuing Transaction object. link_ File Link ID Identifier for a File Link object. or_ Order ID Identifier for an Order object. orret_ Order Return ID Identifier for an Order Return object. person_ Person ID Identifier for a Person object. pi_ Payment Intent ID Identifier for a Payment Intent object. pk_live_ Live public key Public key in a live environment. pk_test_ Test public key Public key in a test environment. pm_ Payment Method ID Identifier for a Payment Method object. po_ Payout ID Identifier for a Payout object. price_ Price ID Identifier for a Price object. prod_ Product ID Identifier for a Product object. prv_ Review ID Identifier for a Review object. pst_live_ Live Connection token Connection token in a live environment. pst_test_ Test Connection token Connection token in a test environment. py_ Payment ID Identifier for a Payment object. pyr_ Payment Refund ID Identifier for a psuedo Refund object of a payment. qt_ Quote ID Identifier for a Quote object. rcpt_ Receipt ID Identifier for a receipt. re_ Refund ID Identifier for a Refund object. req_ Request ID Identifier for a HTTP Request rk_live_ Live restricted key Restricted key for live environment eg. stripe-cli rk_test_ Test restricted key Restricted key for test environment eg. stripe-cli seti_ Setup Intent ID Identifier for a Setup Intent object. si_ Subscription Item ID Identifier for a Subscription Item object. sk_live_ Live secret key Secret key in a live environment. sk_test_ Test secret key Pecret key in a test environment. sku_ SKU ID Identifier for a SKU object. sli_ Subscription Line Item ID Identifier for a Subscription Line Item object. sqr_ Scheduled Query Run ID Identifier for a Scheduled Query Run object. src_ Source ID Identifier for a Source object. src_ Source ID Identifier for a Source object. sub_ Subscription ID Identifier for a Subscription object. tml_ Terminal Location ID Identifier for a Terminal Location object. tmr_ Terminal Reader ID Identifier for a Terminal Reader object. tok_ Token ID Identifier for a Token object. trr_ Transfer ID Identifier a Transfer object. tu_ Topup ID Identifier for a Topup object. txi_ Tax ID Identifier for a customer Tax object. txn_ Transaction ID Identifier for a Transaction object. txr_ Tax Rate ID Identifier for a Tax Rate object. we_ Webhook Endpoint ID Identifier for a webhook endpoint. whsec_ Webhook Secret Secret key for signing a web hook.
Stripe has so many keys and ids this is a very helpful list to decode what exactly an id is for.
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, 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.
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.
...
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.
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.
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.
Get those print colors exact 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 Fantastic resource for learning go. You work through small examples quickly, learning single concepts along the way. Textual is so sick, Will just made a live markdown editor in the terminal! Fastapi passes flask in GitHub stars! Nice take by @t3dotgg. 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. Today I learned the meaning of abhorrent abhorrent ăb-hôr′ənt, -hŏr′- adjective Disgusting, loathsome, or repellent. Feeling repugnance or loathing. If you’re into interesting projects, don’t miss out on draw-a-ui, created by SawyerHood. Draw a mockup and generate html for it 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. Uptime kuma is a fantastic self hosted 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 I deployed it in my homelab today. I came across uptime-kuma from louislam, and it’s packed with great features and ideas. A fancy self-hosted monitoring tool hashi vault lets you manage secrets right from your cli. Looking for inspiration? cloudflared by cloudflare. Cloudflare Tunnel client (formerly Argo Tunnel) The work on vhs by charmbracelet. Your CLI home video recorder 📼 The work on local-ai-stack by ykhli. A starter kit to build local-only AI apps that cost $0 to run – starting with document Q&A. Written in Javascript I’m impressed by pywebcopy from rajatomar788. Locally saves webpages to your hard disk with images, css, js & links as is. I’m impressed by fem-htmx from ThePrimeagen. No description available. Just starred fem-htmx-proj by ThePrimeagen. It’s an exciting project with a lot to offer. No description available.
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1