Managing tmux sessions with fzf
Terminal multiplexers like tmux are essential tools for developers, allowing us to manage multiple terminal sessions efficiently. While tmux itself is powerful, we can enhance its functionality by combining it with fzf, the fuzzy finder, to create a more intuitive session management workflow. The Basic Approach The foundation of this solution lies in combining tmux’s session listing capability with fzf’s search interface. Here’s how we can list all sessions using fzf:...
Azure Functions and FastAPI
I’m a huge fan of FastAPI. It’s a high-performance web framework for building APIs in Python, based on type hints and Pydantic, which enables automatic documentation and data validation. At work, we extensively use Azure Functions. These are serverless resources that reduce the need for infrastructure configuration and maintenance, allowing us to focus more on writing code. To create Azure Functions in Python, we can use the azure-functions package. However, I really love FastAPI as a framework for building APIs....
I Really Like GNU Stow
Ever found yourself painfully recreating config files when setting up a new dev environment? Been there, done that. Let me introduce you to GNU Stow, the symlink cli that’ll make your dotfiles management a easier. What’s GNU Stow Stow is basically a symlink farm manager that helps you organize your dotfiles by keeping them in a separate directory while magically creating symbolic links to their intended locations. It’s like having a personal assistant for your config files....
Quickly Reload Your Neovim Config
Tired of quitting and restarting Neovim every time you tweak your config? There’s a better way! By separating your plugin declarations and configurations, you can quickly reload changes without the hassle. The key is to put your plugin declarations (everything needed to load the plugin) in one file, and the actual configuration in another. For example, let’s look at the zen-mode plugin: Your lua/custom/plugin/zen-mode.lua file would contain the plugin declaration:...
Supercharge Your Git History Navigation with Fuzzy Find
Ever found yourself scrolling endlessly through git log trying to find that one specific commit? Let’s explore how to transform this tedious process into a smooth, interactive experience using fzf, a powerful command-line fuzzy finder. This approach will not only make navigating Git history more efficient but also more enjoyable. Basic Setup: Your First Fuzzy Git log The simplest way to start is by piping your git log into fzf:...
Fuzzy Finding Through Your Command History
We’ve all been there: you type a complex command in your terminal, and a few weeks later, you need it again. Even with autosuggestion enabled, remembering these commands can be tricky. Wouldn’t it be nice to quickly search through your terminal history using fuzzy finding? Let’s build a simple tool that lets you fuzzy find through your command history, select a command, and execute it. We’ll use fzf as our fuzzy finder of choice....
HTML Form and JSON for single endpoint in FastAPI
A common challenge when building a FastAPI application is handling different content types, like JSON and Form data. Any many cases your API needs to support both formats, especially when dealing with web forms and modern front-end applications that often send json payloads. This post demonstrates how to build a FastAPI application that handles and validates both JSON and from data inputs on a single endpoint. The Challenge: Handling Different Content Types By default, web browsers use application/x-www-form-urlencoded or multipart/form-data content types when submitting forms....
VPS 101 - Setup & Security
Recently, I developed an interest in hosting my own servers, which led me to explore virtual private servers (VPS). This is the first part of my journey into hosting a Linux server. Setup & Security To experiment with hosting my own Linux VPS, I opted for the cheapest DigitalOcean Droplet, priced as 4$ per month. I chose this primarily for its ease of use and affordability. It suits my needs, there are maybe other providers that offer similar services (at lower costs), but I’m fine with that....
Python Development Setup
Recently, I started to center my python development around uv and other tooling developed by astral.sh. It allows me to manage python environments, linting and formatting. Managing Python Packages using uv uv is an extremely fast Python package and recently also became a full on package manager. You can install it using curl. curl -LsSf https://astral.sh/uv/install.sh | sh You can then create a new a new Python project, or use an existing one by running the uv init command:...
Git Bisect to Find Bugs
Say you and your team are working on a project. Somewhere in the last 300 commits a bug was introduced. You searched through the commit and their messages. But you can’t find which commit introduced the bug. Damm what are we going to do… This when you can use git bisect, and there are only two things you need the commits are ordered by time you need to know a commit where the issues was not present....
Python to Change VIM
The programming language I’m most familiar with is python. I also started to learn vim recently. How can I combine the two? I discovered that I can use python (or any programming language for that matter) to manipulate text in vim. You simply need to read from the standard input, and provide a output. Script So I wrote a basic python script that can lower case a string. ~/.dotfiles/scripts/lower #!/usr/bin/python3 import sys def to_lower() -> str: return sys....
Remote Access to Homelab using Tailscale
For the last year I’ve been running a small Homelab on a Raspberry Pi 5. It runs a Plex Media Server, Home Assistant, web servers and some Docker images. Until now my Homelab was only accessible from my local network. I was hesitant in making my Homelab remotely accessible (port forwarding , setting up my own VPN). Even though I do a lot of programming and software engineering related things, I’m not too comfortable working with networking side of things....
Find and Replace in Vim
One of my goals for the remaining part of 2024 is to learn and get comfortable with vim. Both with motions and the editor (NeoVim). I started to work with vim about 2 weeks ago and there is so much to learn. However, I think I have some of the basics covered. One thing I wanted to learn this week is find and replace. This is an operation I use a lot, both in my coding work as in my writing....
Run Custom Scripts From Anywhere
Lately I started to look into creating simple scripts that can automate some tasks for me. So I started looking into shell scripting. I wanted to run and have access to these scripts from anywhere in my terminal. After watching a lot of Mischa van den Burg I started taking in interest in more thorough note taking. My first script would be for easier note taking. So I took his blog script tweaked it a little, and wanted to make it executable from anywhere in my terminal....
Finding files using the terminal
Finding notes or files on your system can be hard. Where did you put that file? We can use command line tools to search for files. One of the easiest ways to find files on your system based on their name is using fd. fd [PATTERN] This will return all the relevant files with your current directory. It will also ignore the patterns from .gitignore by default. Another nice tool to find files is fzf which is fuzzy finder....