Golang Thread Blocking Entities

Golang has good concurrency support using goroutines. Goroutines are lightweight threads managed by the Go runtime. Goroutines are multiplexed to fewer OS threads. Goroutines are non-blocking, and they are not scheduled by the OS. The Go runtime schedules the goroutines. The scheduler uses a technique called M:N scheduling. M goroutines are multiplexed to N OS threads. The scheduler schedules the goroutines to the OS threads. The scheduler uses a technique called work-stealing to schedule the goroutines...

Using Pkl in Go

Pkl is a config managment language developed by Apple. It is a simple language to manage configuration files. It has plugin support for popular editors and support for golang. Sample project Let’s start with a simple go project. go mod init pkl-sample touch main.go package main import ( "fmt" ) func main() { fmt.Println("Hello, World!") } Install pkl First, let’s install pkl using brew. brew install pkl Then, Let’s install pkl-go library in our project....

Swagger Docs in Go

Golang is a very good language to create web api servers. I like gofiber framework for creating web api servers. In this article, we will see how to use Swagger in Go especially with gofiber framework. Install swaggo/swag go install github.com/swaggo/swag/cmd/swag@latest Create a new project go mod init github.com/username/projectname Setup Gofiber and Swagger In the code below, we have created a simple API using gofiber framework. The annotations are used to generate the swagger documentation....

Elixir Overview

Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain. It’s functional paradigm and immutable data structures make it a great choice for building scalable and maintainable applications. Few things I like about Elixir are The syntax is very clean and easy to read. The built-in support for concurrency and fault-tolerance. The ability to write highly concurrent and distributed systems with ease....

Running AI Coder Locally

AI Coding tools like copilot, cody etc.. are becoming very relevant and helpful. But, the problem is that they are not available offline. This became a problem when I wanted to travel and had no internet access. So, I remembered about ollama and was looking for a way to use it for my local development. Ollama Ollama is a tool that allows us to run LLMs locally. You can get it simply by:...

Go has less features, so I'm more productive

Golang is well known for the simplicity and performance it offers. It follows a procedural programming paradigm and has a very minimalistic syntax. Sometimes, it’s too verbose compared to some enterprise languages like Java, C# and Python. But, it’s the same reason why I’m more productive with Go. Limited but essential features Go allows us to achieve something in one or only limited amount of ways. This itself is a huge productivity booster as there will be limited choices of patterns to choose from, which makes it easier to make decisions....

SSH Usage

SSH is an encrypted protocol used to connect between two systems. It’s widely used to gain access to remote server and run shell commands. It is also a common thing we use with VCS like github, gitlab etc. SSH Key Generation Creating ssh key is pretty simple, the CLI generates a public and private key pair. The public key is shared with the server and the private key is kept secret....

Python - Multithreaded web crawler

I recently had written a web crawler in Python for crawling through a database website. It was a very interesting experience. I needed to crawl through 6850+ pages and extract data from each page, which required some conditions to be met. I used Python for this task, and it was very easy to write a web crawler in Python. First approach I wanted to make sure it works with a single page ( with 50 links ) properly....

Blazor - Overview

C# ASP.NET offers a way to build highly interactive web UIs using C# and .NET. Blazor helps us to make the app interactive via different modes such as Static Web Apps Interactive Server ( Blazor Server ) WASM (Web Assembly) A Blazor app is based on Components with .razor extention. It is a combination of C# and HTML. Example: // Counter.razor @page "/counter" @rendermode InterativeServer <PageTitle>Counter</PageTitle> <h1>Counter</h1> <p role="status">Current count: @currentCount</p> <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> @code { private int currentCount = 0; private void IncrementCount() { currentCount++; } } // PageTitle....

Mirrord - Overview

When we have a large project with a kubernetes cluster, it’s sometimes difficult to debug and test certain parts of the application. Mirrord allows us to bind a local port to a remote server. flowchart TB request --> mirrord subgraph Pod mirrord -.-x|intercepted| live_server:3000 end mirrord -->|db connection| db[(Database db:5000)] mirrord -->|forwarded| local_machiene(local:3000) local_machiene -.-|connects db:5000 via mirrord| db You can run a local server for example on port 3000 and bind it to a remote server....