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/
Thoughts
Link based "commentary" style posts, commenting on a web link
858 posts
latest post 2026-05-13
Publishing rhythm
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/
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/
[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...
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/
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 ...
-
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/
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/
External Link
X (formerly Twitter) · twitter.com [1]
Textual is so sick, Will just made a live markdown editor in the terminal!
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/willmcgugan/status/1729158038551220477
[2]: /thoughts/
External Link
X (formerly Twitter) · twitter.com [1]
Fastapi [2] passes flask in GitHub stars!
[1]
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/tiangolo/status/1729153717956715007
[2]: /fastapi/
[3]: /thoughts/
-
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.
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/t3dotgg
[2]: /thoughts/
External Link
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.
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/pypeaday/status/1727156823185113304
[2]: /thoughts/
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.
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://heroicons.com/
[2]: /thoughts/
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]
Note
This post is a thought [5]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://uptime.kuma.pet/
[2]: /self-host/
[3]: /homelab/
[4]: https://twitter.com/_WaylonWalker/status/1723077941649707468
[5]: /thoughts/
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...
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]
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/johanhaleby/kubetail
[2]: https://screenshots.waylonwalker.com/kubetail.png
[3]: /thoughts/
-
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
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/
External Link
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]
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/_WaylonWalker/status/1718300097174270193
[2]: /homelab/
[3]: /thoughts/
External Link
X (formerly Twitter) · twitter.com [1]
Wes has some of the coolest OG [2] 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.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/wesbos/status/1717923624559005977
[2]: /og/
[3]: /thoughts/
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]:
<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>
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://htmx.org/essays/locality-of-behaviour/
[2]: /html/
[3]: /htmx/
[4]: /thoughts/
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,
)...
https://neovim.io/doc/user/diagnostic/
neovim.io [1]
Clear out lsp diagnostics in nvim.
lua vim.diagnostic.reset()
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://neovim.io/doc/user/diagnostic.html#vim.diagnostic.reset()
[2]: /thoughts/
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)
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://linuxconfig.org/how-to-kill-process-based-on-the-port-number-in-linux
[2]: /thoughts/
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
Note
This post is a thought [5]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/mkimuram/k8sviz
[2]: https://raw.githubusercontent.com/mkimuram/k8sviz/master/examples/wordpress/default.png
[3]: #installation
[4]: #usage
[5]: /thoughts/
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
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thou...
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
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://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/
[2]: /thoughts/
[1]
Running your own docker registry in one line
podman run -d -p 5000:5000 --restart=always --name registry registry:latest
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://blog.nashcom.de/nashcomblog.nsf/dx/k3s-podman-and-a-registry.htm
[2]: /thoughts/
Kubernetes Persistent Volumes with Deployment and StatefulSet
How to use Kubernetes persistent volumes with deployment and stateful set and also when you should use one or another.
Alen Komljen · akomljen.com [1]
Example of how to add a pvc to a deployment.
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://akomljen.com/kubernetes-persistent-volumes-with-deployment-and-statefulset/
[2]: /thoughts/
[1]
I was curious to see what was going on inside of my minio object storage. Great technique here by Frank to create an inspector pod, then you can do as you wish with the data.
I created the manifest as pvc-inspector.yml
apiVersion: v1
kind: Pod
metadata:
name: pvc-inspector
spec:
containers:
- image: busybox
name: pvc-inspector
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- mountPath: /pvc
name: pvc-mount
volumes:
- name: pvc-mount
persistentVolumeClaim:
claimName: pvc-name
Then used it like this.
# create pvc-inspector pod
kubectl apply -f pvc-inspector.yml
# exec into inspector
kubectl exec -it pvc-inspector -- sh
# explore data
ls /pvc
# cleanup
kubectl delete -f pvc-inspector.yml
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://frank.sauerburger.io/2021/12/01/inspect-k8s-pvc.html
[2]: /thoughts/
External Link
stackoverflow.com [1]
In order to use k8s secrets manifest you first need to encode the data values.
echo -n 'mega_secret_key' | openssl base64
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/53394973/cant-create-secret-in-kubernetes-illegal-base64-data-at-input
[2]: /thoughts/
Can I access k3s using just kubectl (no sudo and no k3s command)
Can I access k3s using just kubectl (no sudo and no k3s command)
Reddit · reddit.com [1]
Right after installing k3s you are going to need to use sudo to use any kubectl command. The reason for this is that the default config is owned by root. To get around this you will need to make your own config and set the KUBECONFIG environment variable
To do this I used sudo one last time to copy the k3s.yaml file into my own directory and take ownership of it.
sudo cp /etc/rancher/k3s/k3s.yaml /home/waylon/.config/kube
sudo chown -R waylon:waylon ~/.config/kube
export KUBECONFIG=~/.config/kube/k3s.yaml
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.reddit.com/r/kubernetes/comments/cojjf5/can_i_access_k3s_using_just_kubectl_no_sudo_and/
[2]: /thoughts/
Quick-Start Guide | K3s
This guide will help you quickly launch a cluster with default options. Make sure your nodes meet the requirements before proceeding.
docs.k3s.io [1]
I recently spun up k3s in my homelab [2]. I’m trying to offload some work off of my free tier fly.io app in order to keep it free tier without crashing.
# install and start k3s
curl -sfL https://get.k3s.io | sh -
# check to see if your nodes are started
sudo kubectl get nodes
My main hiccup so far was the machine I am running on runs zfs on root, and it would not start the master node. Rather than figuring out how to make zfs play nice I just pointed k3s to a drive that is not zfs.
# manuallly
sudo k3s server -d /mnt/vault/.rancher/k3s
# without editing systemd service
sudo ln -s /mnt/vault/.rancher/k3s /var/lib/rancher/k3s
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://docs.k3s.io/quick-start
[2]: /homelab/
[3]: /thoughts/
-
Tailwind comes with space that I have never heard of that is made to give margin and padding together in one class. Adam dropped it here in the Tailwind Connect conference.
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/
Litestar: Effortlessly Build Performant APIs
We all know about Flask and Django. And of course FastAPI made a huge splash when it came on the scene a few years ago. But new web frameworks are being created all the time. And they have these ea...
talkpython.fm [1]
Litestar is an interesting api framework similar to fastpi, that I am interested to check out to see if it fits into some project scope. It sounds like it comes with a lot more batteries included for things like auth, but does not have hard opinions like django. At this point I’m not jumping off of fastapi [2], but its something I want to try.
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://talkpython.fm/episodes/show/433/litestar-effortlessly-build-performant-apis
[2]: /fastapi/
[3]: /thoughts/
Delete a Postgres Cluster
Documentation and guides from the team at Fly.io.
Fly · fly.io [1]
Deleting a fly postgres db cluster was not straightforward to me as the app name is not inferred from the toml like it is for the main app.
fly apps destroy <pg-app-name>
fly pg db list -a <pg-app-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://fly.io/docs/postgres/managing/deleting/
[2]: /thoughts/
![[None]]
Yet again twitter cards were causing me pain. This time it was me not realizing that they require full urls, and not relative or abolute urls.
This was not working
<meta name="twitter:image" content="/shot/?path={{ request.url|quote_plus }}" content-type='image/png'/>
This does work with a full url
<meta name="twitter:image" content="https://thoughts.waylonwalker.com/shot/?path={{ request.url|quote_plus }}" content-type='image/png'/>
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/
-
Boot.dev is crushing it with these interviews. This one has Wes Bos, includes teaching, webdev, where is webdev headed.
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]
This seems like a promising tool to use with ollama.
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://github.com/David-Kunz/gen.nvim
[2]: /thoughts/
Ollama
Ollama is the easiest way to automate your work using open models, while keeping your data safe.
ollama.ai [1]
ollama is the easiest to get going local llm tool that I have tried, and seems to be crazy fast. It feels faster than chat gpt, which has not been the experience I have had previously with running llm’s on my hardware.
curl https://i.jpillora.com/jmorganca/ollama | bash
ollama serve
ollama run mistral
ollama run codellama:7b-code
ollama 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://ollama.ai/
[2]: /thoughts/
GitHub - sysid/sse-starlette
Contribute to sysid/sse-starlette development by creating an account on GitHub.
GitHub · github.com [1]
sse-FastAPI [2].">starlette provides server sent events for startlette and FastApi. I’m evaluating for use with htmx [3].
Installation: # [4]
pip install sse-starlette
Usage: # [5]
import asyncio
import uvicorn
from starlette.applications import Starlette
from starlette.routing import Route
from sse_starlette.sse import EventSourceResponse
async def numbers(minimum, maximum):
for i in range(minimum, maximum + 1):
await asyncio.sleep(0.9)
yield dict(data=i)
async def sse(request):
generator = numbers(1, 5)
return EventSourceResponse(generator)
routes = [
Route("/", endpoint=sse)
]
app = Starlette(debug=True, routes=routes)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000, log_level='info')
Note
This post is a thought [6]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/sysid/sse-starlette
[2]: /fastapi/
[3]: /htmx/
[4]: #installation
[5]: #usage
[6]: /thoughts/
overflow - Layout
Utilities for controlling how an element handles content that is too large for the container.
tailwindcss.com [1]
Controlling overflow with tailwindcss
Examples # [2]
<div class="overflow-visible ..."></div>
<div class="overflow-hidden ..."></div>
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://tailwindcss.com/docs/overflow
[2]: #examples
[3]: /thoughts/