RSSAmplifier

Blog

meain/blog

meain's blog

blog.meain.ioRSS feed ↗65 posts

Latest posts

Building personalized micro agents

Heyo fellow humans, ready for an AI takeover? Me too, or me neither, depending on who you are. To be frank, I'm not an AI doomer and do think it is somewhat good. The only worry for me has been that this makes more things pay-to-win, but then again, it always has been. Ahh, enough with the philosophy; let me get to the actual content. I have always been a big fan of building tools and automating…

Go talk to the LLM

Heyo! These so called "AI" is everywhere these days. This blog is to show all the ways I personally make use of these things. I've been meaning to write this blog for quite some time as I've heard a lot of people saying something along the lines of "I kinda get how this work, but I don't know what to use it for". I'm no expert by any means, but I've been playing around with them for quite some…

Putting Go's Context package into context

Hello Gophers and other beings of the world wide web. The context package is something all Gophers would have used at some point in their life, but do you know what it looks like inside(because apparently the real beauty is on the inside)? If you like this, you can checkout my previous blog post about how sync.WaitGroup work internally here . This is intended more of a quick look at what is going…

How does sync.WaitGroup work

One of my colleagues asked this question to a candidate during an interview. Although I've heard it asked many times, this time it felt different. I sat there thinking, "Do I really know how sync.WaitGroup works?" The question was about using it, but I realized I didn't fully understand how it worked internally. This weekend, I took some time to look into it (and decided to write about it).…

Firefox bookmark keywords for faster navigation

A short entry on how you can use bookmark keywords in Firefox to speed up navigating to common pages. Not sure how many folks are aware of this, but Firefox lets you create “keywords” for bookmarks which can be used to directly navigate to a page. For example, if you often go into GitHub notifications page, you can create a bookmark for it and add a short keyword. I personally use gn as the…

Just enough CORS to not get stuck

Cross-Origin Resource Sharing or CORS is one of those things that I have had to explain to a lot of junior folks. I feel like it is partly because there is a lot of unhelpful and confusing information around it. In this blog, I hope to give a high level overview of what the idea behind CORS is, why it is required and most importantly how to avoid getting CORS errors in your browser. Image credit:…

Navigating around in your shell

I have been using terminals for a long time, initially because I thought they looked cool, and later because I genuinely found them to be easier/faster to get stuff done. And since I've been at it for a while, navigating through directories is something I think I've gotten good at. In this blog, I would like to give some tips on ways you can navigate around in your shell quickly. I rarely type cd…

How I manage my tasks in LogSeq

Here is an overview of how I manage my tasks/todos in LogSeq . I do use LogSeq to take notes as well, but I'm not gonna go much into that here. I started getting more into LogSeq, like most people, when I got addicted to endlessly watching those non-productive productivity YouTube channels where they switch their note taking app every week and expect to be more productive in the new one just…

What is in that .git directory?

Well, I think most of you reading this blog use git more or less on a daily basis, but have you ever looked into what is in the .git folder that git creates? Let's explore it together and understand what is going on in there. This is a blog version of a talk that I recently gave. Unfortunately I can't link to the recording :(. git at a basic level is just a bunch of text files linked to each other…

Splitting and joining using tree-sitter

EDIT: I've since updated the code to support leading commas. You can find that version here Another day, another blog on tree-sitter. Not sure if you have read any of my previous blogs on tree-sitter, but I have a few of them . First, let me show you what this one is about. Here is a recording of the code in action. Video of the code in action splitting and joining rust and json examples You can…

Releasing scopeline.el

Hey, this is a quick announcement about my new Emacs plugin, scopeline.el . You can find it here . What is does is something pretty simple, but IMO pretty useful. It shows you what every closing delimiter is actually closing. When you have a large file and you are the end of a function, you might have a lot of closing brackets, one for the function, one for a loop, one for that conditional you…

What is in a modern code editor?

What do I know? # Before we begin, let me give you an idea of where I am coming from and what my experiences are based on. Just to get it out of the way, I'm currently an Emacs user. That said, I have used a lot of text/code editors, all the way from Notepad to JetBrains IDEs(well, in the past) or even the Borland C++ editor which looked like this running on DOS. I still remember the day I learnt…

EmacsConf 2022

Hey! EmacsConf just concluded and it was a really awesome one this year. A lot of interesting talks. It was a lot of fun interacting with everyone during the event. For folks who where there, "hi again!". If you have read my previous blogs, you might be already aware that I have been playing around a lot with tree-sitter in Emacs. And so, this year for EmacsConf I decided to talk about the same.…

Self hosted location history

I am a big fan of being able to view the history of places that I have been to. Google location history is great in this regards. It records all the places you and you can view this on Google maps. But for some time now I have been removing Google more and more from my life and one of the first things to go was location history along with search and YouTube history. While I don't miss the others,…

Navigating config files using tree-sitter

Yet another entry for tree-sitter . For those new here, I have blogged previously about using tree-sitter here and here . Here is another installment of how I use tree-sitter to simplify/speed up things for me. In this installment we are going to see how we can use tree-sitter to easily navigate around config files. When having to navigate through huge config files there are two problems that I…

Playing around with tree-sitter in Emacs

Tree sitter has been one of those tools that has enabled me to add in a lot of useful features to my dev environment. I have previously written about my Emacs package meain/evil-textobj-tree-sitter which will let you operate on language constructs like functions, classes, loops etc as evil textobjects . I have been playing around with tree-sitter a lot more since and in this blog I wanted to share…

Your terminal on lsd

First of all, sorry about the clickbait title, but I could not stop myself from using this overused joke. What I wanted to talk about in this article is about Peltoche/lsd . lsd is a rewrite of the classic ls command but with a few new and useful(IMO) features. I am the primary maintainer of this project as of now and thought I would go over some interesting features. I have seen a few videos,…

Drag and drop from terminal

I have built up a pretty good workflow in the terminal. The main thing that I was missing until now was an easy way to drag and drop the files that I am looking at in a terminal to other apps. So far, whenever I wanted to share a file from the terminal I would open up a GUI file browser, navigate to that directory, find the file and then drag and drop it. Not anymore. I recently was able to cobble…

A useful shell prompt

I use my shell a lot and have a pretty good prompt which I have built up over the years. It has got to a point where I think I have a pretty good setup and don't find the need to tweak things a lot and so I thought I would blog about it. For the uninitiated, a shell prompt is the thing that to see to the left(and right in some cases) of place where you type in your commands in the terminal. It…

Introduction to nix

I have recently been playing around with nix a lot. It is a really interesting piece of technology. I haven't figured out most of it, but I have already started looking down on people who don't use it. But yeah, in all seriousness, it seems like a really interesting project. Being a beginner I thought I would write a beginner ish tutorial on nix. Here is what nix is if you have not heard of it.…

Intelligent snippets using tree-sitter

I found myself writing a lot more go these days. So far I like the language even thought it seems way too simple at times. That said, one thing that I found a bit annoying was how I had to write all those default values when we have to return an error. I really liked how Rust handed errors, but yeah. In this article I wanted to introduce a snippet that I use which will automatically fill in that…

Releasing gh-issues-to-rss

Project Url: https://github.com/meain/gh-issues-to-rss Yet another package release coming your way. This is more of a scratch my own itch kinda entry. There are lot of projects for which I would like to know when things happen. As of now, there are two options in Github to do this: Subscribe to just releases releases and be late to the party Subscribe to all events and be tired of notifications…

Emacs alternatives for pouplar Neovim plugins

I was a Neovim user for a long time, but I have switch to using Emacs for quite some time now. About 1.5 years. The transition for the most part was pretty smooth except for some initial hiccup. I am now in a state where I as productive or even more when compared to Neovim. So I thought I would write about my experience and what all plugins I have found here that helped me replicate my neovim…

Just flip a coin

A simple life hack that I use a lot. I just wanted to mention why I always use a coin toss to choose if I can't decide between two options. There is only two scenarios I am in when I can't decide between two options I know what to pick, but just can't finalize I genuinely have no clue what to pick In the first case, the only thing that is stopping me on confirming what I want to pick is the…

Releasing evil-textobj-tree-sitter

Link: https://github.com/meain/evil-textobj-tree-sitter Hey everyone, just wanted to mention about a new package that I released recently. The package name is evil-textobj-tree-sitter and you can find it on my Github . This package provides textobjects for evil-mode using tree-sitter . It helps add textobjects like functions, classes, loops, conditionals etc into evil-mode. In case you are not…

A better way to think about tests

Tests are awesome, but not a lot of people want to write them(myself included at times). This is just a rant type blog and I am probably being really dumb, but I had to get this out there. I just wanted to talk about how we introduce beginners to the idea of writing tests. When I started off my career, I was told that tests were a way for one to catch bugs in one's code. Even now, in most cases…

Zooming into Zoom meetings

Well, I have been attending a lot of meetings lately. More than I would like to admit. The number of meetings have gone down compared to the start of the pandemic, but it is still a lot. To be frank, sometimes really you have to talk things through instead of just texting people. OK, with all that aside, let me get to the actual content. I just wanted to show you a quick simple hack that I use to…

Edit everything in Emacs

Hello everyone, another installment of me going over my setup. This is one of those things which I don't use all that much but wheneve I do, I really am glad that this is a thing. Video of what I am talking about Let me first explain the feature that I am talking about. I have my editor(Emacs) setup exactly how I want it to be(for the most part). Here is a sample workflow which I am trying to fix.…

Templating things in Airflow DAG

Just another, TIL type entry. It is about Airflow. I have been working with Airflow for quite a while. I don't really like it to be frank, but I am stuck with it for now. With all that said, you can do everything that you want to do in Airflow. There is always some way to do everything. If you try really hard, you will be able to find even a way to capture Mewtwo. I am not saying this is something…

Just a simple markdown previewer

I really like markdown. I write everything in markdown be it blogs, presentations, emails, todo lists, documentation, everything is in markdown. For the most part I can parse and render markdown in my head and don't need anything more than a simple text editor that will let me write stuff down. But, from time to time, I do like to render the markdown out and see how it would look. I also use git a…

My workflow hacks

Well, the year is about to end. It was a fun year, no shit. I wanted to write something like this for quite some time. I was like, "too lazy today, tomorrow" and the year is almost over. I did not want to keep this pending for next year and so started working on it. Well, I just wanted to mention a bunch of thing that I have in my workflow to make my life a bit less miserable. I don't think…

Highlight yanked region in Emacs

OK, so I recently switched over to Emacs just becuse I woke up one day and got the itch to write some lisp. It has been pretty fun so far. Now with that out of the way, let me tell you about what I was actually planning to write about. The idea is to show you a small example of how I am able to hack together stuff in Emacs. I know someone will ask for it, so here are my dotfiles . Steal away.…

Just a bunch of git stuff

Hey, Been a while since I have wrote a blog and thought I would write about something that I really like, git. I really like git, almost all of my important data is text and almost all of them are versioned using git. Here is a bunch of things in git that I think are not that widely known. Worktree # Worktrees are useful if you work on a bunch of branches at the same time. It really comes in handy…

Floating scratch terminal in tmux

Hi, Just another one off blog. I have been using tmux for a while and one main thing I always wanted to have in tmux is a floating scratch terminal. I got so used to this during my time with i3 and wanted to replicate it with just tmux. Check out what I am talking about on Youtube . Code used here: script and tmux-config A while back, tmux actually got foating window support and I am using it for…

What you need might not be Kubernetes

Let me get this out first. There is small chance that what you need is Kubernetes, but it is highly unlikely. What you need is not Kubernetes. What you need is scaleable deployments. If you haven't already been able to tell, this is more of a rant blog. Just my opinions. Yup, I have them. Let me explain how this went for me. I was dealing with a lot of scaleablility issues related to deploying…

Copy file opened in macOS preview to working directory

Another random script I pieced together recently. I generally have a bunch of temp folders that I keep around for files to go in. And at times, I have pull some files into the current folder I am working on in my shell. If those are pdf of image files, I usually have them open in macOS preview which btw is a neat tool. Anyhow, when I now have to copy the file to my current location inside the…

Completely remove a file from git history

UPDATE: I did run into some pretty good documentation from GitHub here . One caveat is that inorder to remove it from pull requests, you will have to get the GitHub team involved. Another short one. Imagine this situation, you committed a file containing passwords into git accidentally. What do you do? Pretty easy, you just revert that commit. The command below show do the trick. git reset --soft…

What exactly are stock options?

So yeah, this is me trying to write a non technical blog. Not sure how this will end up. This is just an intro, very basics of what I wished I knew when I started off. I am not someone who really knows what I am talking about here, you have been warned. What are they? # Stock options are an agreement that the company that you work for gives you about its stocks. The agreement pretty much says that…

A simpler method for a reactive UI

Hola¡ I have been doing frontend for a long time. I started off with vanilla JS, then used jQuery and after that moved directly onto using pretty much React. I have tried out a lot of others and most of them seem to have this idea of having the UI as a pure function of your data at the core. I really liked the idea of having your UI as a function of your data. This idea really stuck with me that I…

Mounting S3 bucket in docker containers on kubernetes

Another installment of me figuring out more of kubernetes. Full code available at meain/s3-mounter So, I was working on a project which will let people login to a web service and spin up a coding env with prepopulated data and creds. We were spinning up kube pods for each user. All of our data is in s3 buckets, so it would have been really easy if could just mount s3 buckets in the docker…

Auto shutdown VM if no active SSH connections

Here is a simple workflow that I have extracted out into a blog. I generally have a VM on standby to offload some tasks over to that VM instead of running things on my laptop. One main example of this is when I am trying to do some experiment and check if a container still builds after I do some changes. I usually make the changes and offload the build piece over to the VM. A good thing about VM…

Dynamic reverse proxy using nginx in Kubernetes

OK, first of all, let me make sure that you understand what we are trying to do here. Let us say that I have a lot of kubernetes services with names like below. This list may grow or shrink dynamically and is controlled by some other script. I am spinning up a dev instances for each use as they login. Something new I am working on. exper-0 exper-1 exper-2 exper-3 exper-4 Now if I do not wanna…

Switching to DuckDuckGo

So yeah, recently I decided to switch from Google to DuckDuckGo. DuckDuckGo is great, don't get me wrong. But at times, Google just has better results. I usually find myself going back to Google for a max of 10%-15% searches. DuckDuckGo is really good, just not creepy good. If DuckDuckGo fails # I am a lazy person, if I have to do the search two times I will be pissed. So, I was thinking about…

Table operations like in Nu shell in BASH

Hi, another installment of why people should just write more bash. I am not sure if you are aware of it. There is a new shell written in Rust called Nu Shell . One of the main ideas of it is that you treat every data as table data and then work on top if as if you were working with SQL queries. I am not a big fan of this approach personally. I would stick to treating data as a text stream than a…

How to create a SVG blob thingy in HTML Canvas

You might have seen a lot of colorful blobs everywhere these days. It is simple and looks pretty without much effort. You even have tools like blobmaker.app to help you easily create blobs. Let me show you how you can code up your own svg blob thingy. Here is what we will be building. github and codesandbox OK, here we go. 1. Prepare environment # Below is the basic setup. Once this is out of the…

Making sure you won't commit conflict markers

Recently I made a mistake of committing a conflict marker and pushing that code to Github. That is when I thought that I could have a easily avoided this if I had added a git-hook to warn me if the code that I commit had conflict markers. Here is how you would set up something like that. What are git-hooks? # In case you are new to git-hooks , it is a way by which git lets to hook into the…

Accessing Kubernetes API from a Pod (RBAC)

This article describes in general how to set up permission for a Pod so that it will have access to Kubernetes API. My exact use case was that, I wanted to run a Pod which will watch a redis queue and then start a job whenever there is a new item in the queue. I will only be explaining how to set up the permissions and I think the rest of the tasks has been well explained by a lot of people. So, I…

Git never forgets, well kinda. `git-reflog`

Hi, I am gonna let you in on a little secret. Git never forgets what you do, you can mess up however you want and you will still have all your data available*. * as long as you have committed you code and also only for 90 days OK, I am not taking about the fact that you can you can see the logs of what changes you have made over a period of time. I am talking about that fact that you can even…

Setting local files as New Tab page in Firefox

This will not work as of Firefox 72 So, I was going through r/startpages and checking out the startpages there. A lot of them looked pretty awesome and I decided to create one. And create, I did meain/startpage . But yea, setting a local file as startpage is a messy deal in Firefox. Lot of people seem to set up a local server and even after than end up having to use a plugin to get things working.…

Understanding Kubernetes (Basics)

So yeah, you have an amazing app(I am gonna assume it is in python) that you would like to deploy. You know how to deployment works. You spin up an instance on gcloud or aws or azure or somewhere else. You install python, no python3, then pip install requirements.txt. Set up your database, maybe redis. Now you make sure firewall rules are ok if you are deploying on some other port and you start…