CSR and SSR rendering pattern

A UI in context of web applications is the HTML, CSS and JS that is sent to the browser. HTML is the structure of the page. CSS is the styling. JS is for programming browser to manipulate DOM / browser environment. The rendering patterns can be classified based on where are we running the process to generate the html required to display for the user. Things to keep in mind when rendering When rendering UI, there are primarily two factors to consider. ...

Package managers

Package managers allow to manage a project’s dependancies run configurations etc.. mostly in an isolated way. They can also manage versioning related to these packages. Here are managers for few different languages Nodejs bun, pnpm, yarn, npm Go go mod Rust Cargo C# dotnet Nuget Python pip What do they do? Let’s see how we share code without package managers. We write code and share it with others by copying the code and pasting it in their project. To manage the versioning, we can potentially use version control systems like git. Package manager automates this process and makes it easier to manage. ...

Nextjs - Overview

What is Nextjs ? Is it a framework ? Is it a static site generator ? Is it a server side rendering framework ? Is it overhyped ? Yes ! Next js is a framework which uses react as its base. Let’s explore some of it. Nextjs as a framework Routing Nextjs provides a good structure of application by providing directory based routing for pages. We can create a route by creating a file named page.tsx in the app directory and the directory path will follow the route path. ...

Go - Dependancy Injection pattern.

Dependancy injection is a pattern where we pass down dependancies to initializers. This pattern is used to avoid global variables and to make code more testable. For example in go, you can create a service which depends on a repository and pass the repository to the service initializer. Suppose you have a directory like this server ├─entities │ ├─data.go │ └─server.go ├─handler │ └─handler.go ├─service │ └─service.go └─storage └─storage.go main.go suppose you have a User struct in data.go ...

Running Async Tasks in Django using Celery

Django is one of the best web frameworks to build some thing fast which comes with a lot of features. Even if it doesn’t appeal in terms of raw performance, it is one of the fastest frameworks in terms of development iteration. Celery is a distributed task queue that helps us to run tasks asynchronously. It is widely used in Django applications to run background tasks such as sending emails, processing images, etc. ...

Vim Cheatsheet

Vim Cheatsheet Cursor Navigation Vim has several commands for moving the cursor around the file. Here are the basic ones, which work in Normal mode: h: Move cursor left j: Move cursor down k: Move cursor up l: Move cursor right These are some more advanced commands: w: Move to start of next word b: Move to start of previous word e: Move to end of word 0 (zero): Move to start of line ...

Why are we fascinated by AI ?

Why are we fascinated by AI? I’ve been thinking of this for a while now. People are so hyped about AI, especially generative AI. It would be a lie if I said I wasn’t impressed, but behind all the excitement I also paused to analyze the whys. To gain an answer to this, I stepped back and thought about the scenarios where we get fascinated before the AI hype was there. All I could think of was, how a beginner musician get impressed by a skilled musician, how a beginner sportsman gets impressed by a skilled sportsman etc… ...

Some thoughts on Wealth

Some thoughts on Wealth There is being rich and there is being wealthy. The clear line between wealthy and rich can by simplified into two words, Discipline and Lifestyle. Let’s say if we stopped working or doing anything, how long can we survive? If we can survive for a long time, we are wealthy. Wealthy people often may not seem rich as well. Whereas rich people may not last long without working. Rich people might have houses, cars, and other commodities but they might be in debt or have a lot of expenses. ...

CI/CD Setup

Steps I follow to setup a CI CD workflow. Write Dockerfile in the code repo. Write a k8s Manifest file using kustomize template. Following this tree structure. ├── base │ └── app │ ├── deployment.yaml │ ├── kustomization.yaml │ └── service.yaml └── overlay ├── production │ └── kustomization.yaml └── staging └── kustomization.yaml Write a skaffold file ( skaffold init will auto initialize itself ). Build Docker image and Render the k8s manifest using skaffold. skaffold build && \ skaffold render --digest-source='tag' -p staging -o ../path-to/manifest.yml Manually push the rendered k8s to the manifest repository. Setup the k8s to access the private repository kubectl create secret generic <secret-name> \ --from-file=.dockerconfigjson=~/.docker/config.json \ --type=kubernetes.io/dockerconfigjson Update the K8s manifest with spec: template: spec: imagePullSecrets: - name: <secret-name> Setup argo cd in the target k8s cluster. ArgoCD Getting Started kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo Login and Link repository to argocd. Create an app in argocd and configure to access the repository and the cluster to deploy.

Programming

Programming On a high level, Programming is simply writing instructions to a computer on how to compute or process data and give the desired output, in a programming language. Also, the input and output can be nothing. Either way, a program written involves changing the state of a system. A computer is a state machine and all it does is flip 0s and 1s. These details are abstracted from us as computer science has evolved. ...