A minimal todo app for Waybar

🖊️ 🔖 linux 💬 0

What is the simplest TODO app imaginable? In my opinion, it’s just a text file in your home directory named todo.txt. One line per item, edited with Vim. No need for additional software, websites, or electron apps.

Using standard unix tools, this setup is easy to extend. In my case, I wanted a persistent, nagging reminder of my constant procrastination. I also use waybar. Naturally then the end goal is a custom module.

Image

Obviously, it displays the number of TODOs you have remaining. Additionally, hovering over the module will print display them in a tooltip. When you click a new Neovim instance will spawn opening the file.

Simple and effective. Here’s the code. I placed this is ~/.config/waybar/scripts/todo.sh:

#!/bin/bash
COUNT=$(wc -l < ~/todo.txt)
TODOS=$(cat ~/todo.txt | head -c -1 - | sed -z 's/\n/\\n/g')
printf '{"text": "%s", "tooltip": "%s"}\n' "$COUNT" "$TODOS"

And then add a custom module to ~/.config/waybar/config:

 "custom/todo": {
        "exec": "~/.config/waybar/scripts/todo.sh",
        "return-type": "json",
        "format": "{} todos",
        "on-click": "wezterm -e nvim ~/todo.txt",
        "interval": 5,
    }

Replace wezterm with your preferred terminal emulator and you should be good to go!

Speeding Up API Endpoints using Python AsyncIO

🖊️ 🔖 code python 💬 0

As a developer, you want the APIs you write to be as fast as possible. So what if I told you that with this one simple trick, you might be able to increase the speed of your API by 2x, 3x, or maybe even 4x? You’d probably tell me to get lost with the clickbait, but hear me out. In this article you will learn how to utilize Python asyncio, the httpx library, and the Flask micro framework to optimize certain parts of your API.

A Humble Makefile

🖊️ 🔖 code 💬 0

I’ve been adding GNU Makefiles to all my projects recently and it’s not because I’ve suddenly become a C programmer.

Shell Plus for SqlAlchemy

🖊️ 🔖 code python 💬 0

If you’ve ever used Django, you might be familiar with Django Extensions Shell Plus. It allows you to execute $ ./manage.py shell_plus for a very handy iPython REPL with all your ORM models pre-imported. This snippet will allow us to accomplish the same with FastAPI or Flask.

Choosing the Right ORM for FastAPI

🖊️ 🔖 code python FastAPI 💬 2

When developing a large database backed application, using an ORM (Object Relational Manager) can really benefit your project. There are quite a few ORMs for Python, but which work best with FastAPI?

Location Based Search for FastAPI

🖊️ 🔖 Tutorial 💬 0

Are you interested in adding geographical capabilities to your app? Perhaps you want to be able to search for nearby items on your site. Or maybe you want to know if your user’s location is within a specific region. With a few tools it is easy to add GIS (Geographical Information Systems) to your FastAPI back end.

FastAPI Fundamentals: Data Serialization and Pydantic

🖊️ 🔖 code python tutorial 💬 0

Pydantic is one of the “secret sauces” that makes FastAPI such a powerful framework. The library is used everywhere in our projects: from validation, serialization and even configuration. Understanding better what Pydantic does and how to take advantage of it can help us write better APIs.

Adding Database Backed User Authentication to FastAPI

🖊️ 🔖 code python tutorial 💬 1

In this tutorial we will learn how to add database backed user authentication to our FastAPI application. Later is the series we will implement registration, password recovery, and more.

Building an Instagram Clone in 50 Minutes with Django

🖊️ 🔖 code tutorials 💬 0

Recently I did a live tutorial with CodingNomads on how to build an image sharing website (like Instagram) in Django. The demo is meant to show how quickly you can leverage Django to build and prototype web applications. You can view it on YouTube.

California Smoke

🖊️ 🔖 other 💬 0

Posting these here so I can look back in the future to remember when the forest fires started getting really bad.

Image

The view at about 3:30 PM PST from the viewpoint near the Hwy 92/Skyline Blvd intersection.