Posts

Showing posts from December, 2019
I finally bought the Interpreter Book on Kindle store.
A nice write-up about following RFC like process for managing Engineering team at organizations.

https://buriti.ca/6-lessons-i-learned-while-implementing-technical-rfcs-as-a-management-tool-34687dbf46cb

Vanity Imports in Golang

The imports in Golang are the fullpath of the package including the domain name. It is common to host the packages on Github and use it for import as well. However, there are two problems with it.
Long imports: Packages under Github have to have github.com/<username>/<repository-name> at the beginning which is rather long considering some repositories have nested sub-directories. This is true for internal packages in the repository as well, when you want to import a package from a different sub-directory but you still have to use the entire Github prefix. Hassle in switching the hosting The package name is the unique identifier for the package and having the hosting provider name in it means its a hassle to switch provider even for internal packages.
The two aforementioned problems can be solved using vanity imports in Go. What vanity import means is using a custom domain for package imports.
github.com/<username>/<repository>/pkg/<xyz> -> <user.t…

Backup SQLite

The Writefreely instance running the current website is using SQLite database to store the content. SQLite is an embedded relational database which primarily ships as a library with bindings for a lot of programming languages. It also ships a helper command line utility sqlite3 which can be used to interact with database file. This tool can be used to take backup by calling .backup command.
$ cat backup.sh !#/bin/sh sqlite3 /path/to/writefreely.db ".backup /backup/path/backup.db" $ This is equivalent to SQL dump which can be imported in a new instance if need arises. The backup process can be configured to run everyday using cron daemon. The cron expression for taking backup at midnight 12 is 0 0 * * *. The following line can be added to cronjob to automate the process. 0 0 * * * ~/backup.sh Cron expressions for different time/frequency can be easily generated using the web-based tool called crontab.guru.
For offsite backups, the SQL dump can be copied to a remote machine usi…

Golinks

This project is a very simple webapp inspired by Google's internal “go” system. First time I came to know about this was from this Gitlab thread. Also from the same thread I came to know about an open-source implementation of it at kellegous/go.

I have been working with Golang extensively at work and otherwise for the past year but this is my first web application in Go. The application is analogous to a URL shortner with the different that you get to choose the slug. It implements the functionality of adding and deleting as well as listing all links. I also semi-implemented authentication where it assumes an external system (middleware) to do it and set a specific HTTP header. I am using Cloudflare Access for implementing this in my current setup.

I used Mux router to build the endpoints with two middlewares for logging and authentication. For logging, I used a leveled logging library by Netflix engineer called zerolog. I used Go implementation of LevelDB which is an embedded …

Interpreter Book and Compiler Book

Someone at work shared the link of Interpreter Book. It looks interesting and I want to read it. The book is about writing an interpreter for Monkey language in Go and learning through the process. The author has also written the Compiler Book. The books are available as both eBook and physical copy.

Toxic Masculinity

Why do some men think of themselves as superior to the women? Why do some men try to overpower women at times? Is it really a cultural thing? Or is it limited to certain generations? Is it something hard-coded in our nature which we learn to fight back to fix ourselves? Or is it taught to us through various institutions?

I don't have answers to these questions but I want to acknowledge that these kinds of problems do exist in the real world. It often shows up from time to time in news and media in some extreme form. However, very subtle elements can be seen everywhere.
When I see signs like “This Taxi Respects Women”, I get a feeling that we are still not trying to find the root cause of the problem and are instead trying to treat the symptoms. Of Course everyone should respect women but why are we not doing that in the first place?
A nice write-up by Paul Graham where he talks about how “studying for grades” in school is damaging.

http://paulgraham.com/lesson.html
I bought a new domain tonight for the Writefreely instance. The instance is running at argb.in now.

Federated Git

Git in itself is distributed in nature. That's why it is called distributed version control. But what I really mean by federated Git is the Git hosting services. There are some popular hosted services like Github and then there are open source selfhosted alternatives like Gitea and Gogs. But for someone to switch to something like Gitea entirely is not an option (if they want to contribute in other projects) since there is no way of creating pull requests or follow projects across the services. For someone to create a pull request, they need to have an account on existing hosting service and create it from there. This feels limiting considering the distributed nature of underlying software, Git.

One solution to this can be Federated Git, similar to Fediverse. That means anyone can host an instance and submit there changes to any other totally different service as long as both of them implement same protocol. ActivityPub is one such protocol used for federation. I do not know the…
Image
Yeh Meri Family music keeps playing in my head.

Switched from Pocket to Instapaper

I was a user of Pocket, in fact one of the top 5% users until recently when I decided to switch to Instapaper. Why? you ask, I had several reasons and I'm going to talk about them. First reason, the sole job of a Read It Later app is to parse the webpage and present it nicely when asked for and stay out of the way. Pocket's parser is not the best especially when the page contains source code. Sometimes it would entirely remove the code or parse it as normal text removing all the formatting. This defects the sole purpose of Pocket. Second reason, the free version of Pocket lacks full-text search which basically means I cannot search 500+ saved articles. Now, offcourse one can pay the 4.99$/month price to get that feature but I never wanted to pay because of the first reason. This really bugged me in past few days since I wanted to search something and tried to go through the list of articles saved but couldn't find it. So, I finally decided to switch.

I tried looking for …

Miniflux

On one of my explorations for Selfhosted software, I came across Miniflux. It is a very minimal feed reader web application. On little research I found out that it is a Golang rewrite of Miniflux v1 originally written in PHP. I have a sweet spot for Golang software specially web applications. Setting them up is really just a matter of installing binary and setting up a system service. I decided to give it a try so I went on the website and turns out the developers provide a hosted solution for just $15/year with a 15-day trial.

I registered on the hosted version to try it out. I really liked the minimal interface and utilitarian appearance which gets out of the way. It also comes with built-in integration with a lot of Read It Later services including Pocket, Instapaper and Wallabag.

After making my mind I decided to install it on the server. It needs PostgreSQL so I installed it from Debian repository and followed the installation guide. After setting it up, I created a sub-domain…