meain/blog

meain's blog
https://blog.meain.io/ (RSS)
visit blog
Go talk to the LLM
2 Oct 2024 | original ↗

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...

Putting Go's Context package into context
9 Jun 2024 | original ↗

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 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...

How does sync.WaitGroup work
26 May 2024 | original ↗

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...

Firefox bookmark keywords for faster navigation
17 May 2024 | original ↗

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...

Just enough CORS to not get stuck
8 Feb 2024 | original ↗

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...

Navigating around in your shell
16 Nov 2023 | original ↗

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...

How I manage my tasks in LogSeq
17 Oct 2023 | original ↗

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...

What is in that .git directory?
6 Oct 2023 | original ↗

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...

Splitting and joining using tree-sitter
15 Mar 2023 | original ↗

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...

Releasing scopeline.el
12 Mar 2023 | original ↗

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...

What is in a modern code editor?
11 Dec 2022 | original ↗

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...

EmacsConf 2022
5 Dec 2022 | original ↗

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...

Self hosted location history
17 Sept 2022 | original ↗

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...

Navigating config files using tree-sitter
12 Jul 2022 | original ↗

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...

Playing around with tree-sitter in Emacs
18 May 2022 | original ↗

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...

Your terminal on lsd
26 Mar 2022 | original ↗

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...

Drag and drop from terminal
23 Feb 2022 | original ↗

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...

A useful shell prompt
12 Feb 2022 | original ↗

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...

Introduction to nix
6 Nov 2021 | original ↗

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....

Intelligent snippets using tree-sitter
16 Oct 2021 | original ↗

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...

Releasing gh-issues-to-rss
13 Oct 2021 | original ↗

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...

Emacs alternatives for pouplar Neovim plugins
29 Sept 2021 | original ↗

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...

Just flip a coin
10 Sept 2021 | original ↗

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...

Releasing evil-textobj-tree-sitter
9 Sept 2021 | original ↗

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,...

A better way to think about tests
8 Sept 2021 | original ↗

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...

Zooming into Zoom meetings
31 Jul 2021 | original ↗

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...

Edit everything in Emacs
26 Jul 2021 | original ↗

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)....

Templating things in Airflow DAG
12 May 2021 | original ↗

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...

Just a simple markdown previewer
27 Apr 2021 | original ↗

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...

My workflow hacks
31 Dec 2020 | original ↗

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...

Highlight yanked region in Emacs
20 Nov 2020 | original ↗

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...

Just a bunch of git stuff
6 Nov 2020 | original ↗

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...

Floating scratch terminal in tmux
15 Sept 2020 | original ↗

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...

What you need might not be Kubernetes
21 Jun 2020 | original ↗

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...

Copy file opened in macOS preview to working directory
2 Jun 2020 | original ↗

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...

Completely remove a file from git history
22 May 2020 | original ↗

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...

What exactly are stock options?
20 May 2020 | original ↗

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...

A simpler method for a reactive UI
16 May 2020 | original ↗

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...

Mounting S3 bucket in docker containers on kubernetes
12 Apr 2020 | original ↗

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...

Auto shutdown VM if no active SSH connections
5 Apr 2020 | original ↗

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...

Dynamic reverse proxy using nginx in Kubernetes
30 Mar 2020 | original ↗

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...

Switching to DuckDuckGo
17 Dec 2019 | original ↗

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...

Table operations like in Nu shell in BASH
16 Nov 2019 | original ↗

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...

How to create a SVG blob thingy in HTML Canvas
12 Nov 2019 | original ↗

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...

Making sure you won't commit conflict markers
11 Oct 2019 | original ↗

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...

Accessing Kubernetes API from a Pod (RBAC)
12 Aug 2019 | original ↗

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...

Git never forgets, well kinda. `git-reflog`
10 Aug 2019 | original ↗

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....

Setting local files as New Tab page in Firefox
27 Jul 2019 | original ↗

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...

Understanding Kubernetes (Basics)
26 Jun 2019 | original ↗

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...

Beginners guide to tensorflow serving
11 May 2019 | original ↗

tf-serving if you don't know is a tool that Google has built to serve model built using tensorflow. Even keras models with a tensorflow backend should do just fine. Even thought there are a lot of guides on how to use tf-serving, I could not find anything coherent and simple. So I decided to write one, mostly so that next time I have to do this I...

Automatically list files after cd
6 May 2019 | original ↗

Almost everybody does an ls after they cd into a folder. So why not get your shell to automatically do it? The simple way # Well, you might know the simple way. Just change cd to do cd and ls. cd() { builtin cd "$@";ll;} The grown up way (in zsh) # Well, even though the previous one works well for most cases, there might be some situations in...

A bit more about configuring nginx (rewrite and alias)
30 Apr 2019 | original ↗

We went through some basic stuff you need to understand to configure nginx in an old blog. After writing that I had to work on another project which was a bit messy. So I went over more stuff, and I thought I would write about it. Before going into the blog, let me go in what is the situation that I was in. I had two frontend (static file)...

How to do server side autocompletion (networking parts)
26 Mar 2019 | original ↗

So, recently I had to create an autocompletion for a chat app at work. We did not need anything fancy for the first cut. Sounded like a simple project. This was in React I initially thought of pulling in an existing library for it, but our requirements needed some special kind of autocompletion menu. Let me tell you what I mean by that. We build...

Understanding Rust macros
17 Feb 2019 | original ↗

Yo, I have been working on Rust for some time now. It is a great language and a refreshment coming from a primarily Python and Javascript background. I feel like the compiler has got my back even though it yells at me a lot. I feel like I could refactor something and if the compiler does not complain, nothing will break. But that said, coming...

A really simple nginx config
8 Jan 2019 | original ↗

This is another installment of "this is not a blog but a note for my future reference". Here, I will introduce you to writing a very simple nginx config file. The use case I will go over here assumes you have a directory of static files and a backend running somewhere. Where to put the files # First of all the config file is supposed to be...

Publishing a console application to pypi
28 Dec 2018 | original ↗

Let's say you have a very useful python script that you use and think other people might have some use out of it. One way is to just share the python snippet, but nah, that is too old school. Let us publish it to pypi so that anyone can just do a pip install your-awsome-tool and get going with it. So, how to do it? # Well, let us create a simple...

Docker basics
9 Nov 2018 | original ↗

Hi, the idea here is to introduce you to how docker works in very basic terms. We will go through how to create a docker file and how to run it and stuff like that. But just the basics, just enough to get you started on docker so that you can take on from there by yourself. I am not going to discuss as to how to install docker. Just go and look...

Quickly go to project root
4 Nov 2018 | original ↗

Let us say you went deep in to a highly nested project structure and want to get back to the project root. Sure you could go cd ../, nah not here cd ../../, not here either ..... But there is a much better way to do this. You can leverage git to find where the project root is. git rev-parse --show-toplevel 2> /dev/null This gives you the project...

Connecting `Redux` to `React`, simplified
24 Jan 2018 | original ↗

So, you have been working on your React project. Maybe you have heard about Redux and how it can make it all better and need some help getting started. What is Redux? # Hmm, good question. It is like this master thingy which handles the state of all your components rather than handling the state in the components. So what you do is when you need...

Take a picture of you every time you open your laptop
9 Jan 2018 | original ↗

Take a photo every time the lid is open using the laptop camera. Hey, ever seen those time-lapse videos of plants growing up in a BBC documentary and thought wish I could do that for me. You haven't? I knew. But here is how you would do it if you had thought of doing it. ( in OSX ) It also helped me to see who tried to open up my laptop when I...

Creating a tic-tac-toe game in Clojurescript using Reagent
28 Sept 2017 | original ↗

Whoosh, I am tired of JS all day long, let me try out something else. And yeah, I ended up here. Actually I was kinda playing around with Haskell before I reached here. It feels pretty good to have a change from the usual stuff. To be frank I think everyone should try out functional programming at some point of time. Well, enough bullshit let us...

Ehh, Webassembly?
27 Aug 2017 | original ↗

Well, hey. So, what is Webassembly? # To be blunt and simple it is just assembly on the web. What you do is write in a low level language such as C, C++ or rust(a new language by Mozilla) and convert them into assembly(sort of) language and ship that to browser. Why new stuff though? # Well, JS was a language which had performance as an...

How Emacs took over my Vim life
13 Jun 2017 | original ↗

Edit: I am back to using neovim. I was a fanatic Vim user for about two years and use to believe that Vim is the only text editor that was cool. But, now I use Emacs. My emacs and neovim config What is the problem with Vim? # Well, Vim was a great tool for editing text, not for editing code. The one main issue I was facing with Vim was due to its...

How to make Vim and Tmux friends with system clipboard
27 May 2017 | original ↗

Fist of all, a small apology. The tmux solution is a bit specific and works only if you are using macOS and iTerm as your terminal emulator. Get Vim to play nice # Getting Vim working with the system clipboard is the easy part. On macOS ( Sierra ) # This is very easy. You will have clipboard support out of the box. You can get the clipboard...

↑ these items are from RSS. Visit the blog itself at https://blog.meain.io/ to find other articles and to appreciate the author's digital home.