Posts
How git stores changes
Git stores snapshots of the directory content at the moment. (Contrast older VCS systems which just capture the changelog) If files haven’t changed it just points to the previous version.
We can check the content of the commit blob. It’s stored in .git/objects. It’s stored as a compressed zlib file.
~/projects/my-project/.git/objects/1a(my-branch) » pigz -d < 58989906551da9cd7f2395c640e0b90667aa27 commit 677tree f1c83252e98f54138359308ef247193bf4e0bef4 parent 1747b1d081167971b9612ad75862943e8a9f344c author Mister Author <mister-author@host.com> 1567673031 +0000 committer Mister Author <mister-author@host.
read morePosts
Curious Case of super huge syslog
The Problem:
Insufficient memory left on /root partition.
On inspection I found that it was happening because /var/log was growing till 35 GB (I have a root partition of 50 GB).
On further inspection I found that /var/log/syslog was huge
Following was the repeating line (error log that would quickly fill up my disk space)
Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.
read morePosts
Infrastructre as Code (IaC)
How it came to be? Traditionally setting up infrastructure for the code to run (think: servers, network configurations, etc) has been a manual task.
People started using SOP (Standard Operating Procedure) in order to mitigate errors and risk (by listing down all the actionable items) but it’s still error-prone.
Enter, Infrastructure as code.
This is an attempt to abstract the tangible aspects of software (hardware it runs on, configurations and network it uses, etc).
read morePosts
Good Object Modelling
OOP is all about Encapsulation Yes, that’s right. Object Oriented Programming aims to encapsulate properties and methods into a consolidated object so that’s operations can be carried out on the object. The whole aim was to move from procedural functions which were not easy to reason about and prove correctness. But this principle often gets violated and people write procedural code using objects. Classic Example is:
class Rectangle { private Long length; private Long breadth; //gettters //setters //constructors } And caller calculates area by:
read morePosts
Slack WebHook, A use case
Linux Terminal Controlled Slack WebHook This is a simple use case of slack webhooks. Slack webhooks can be configured to send messages when some events occur, i.e. we trigger the hook and the hook sends the message to slack channel configured.
I have set up a workspace (for my own personal experimentations) and created a webhook which is a fairly simple process. Web Hook can be called via HTTP POST call with required message.
read morePosts
21 Lessons (Book Review)
21 lessons for the 21st Century (Book Review) 21 Lessons for the 21st Century by Yuval Noah Harari My rating: 5 of 5 stars We live in an extremely complicated world. It’s so difficult to make sense even of the tiniest realm of our lives. Religious dogma, political gambles, economic disparity, an ever-increasing gap between poor and rich, promises and dangers of new technologies like Machine learning and artificial intelligence form the most confusing crossroad in all of the recorded human histories so far.
read morePosts
HTTPS vs SSH end points in github/bitbucket
Read Sudip Bhandari's answer to What should I do such that Git doesn't ask for username and password while pushing and pulling the code? on Quora
read morePosts
Linux aliases
Read Sudip Bhandari's answer to How can I create aliases in Linux command? on Quora
read morePosts
Quick & Simple screencasts using Peek
Read Sudip Bhandari's answer to Can you surprise me with a Linux software so good I didn't know I need it until now? on Quora
read morePosts
Setting up local postfix to send mails via Google's SMTP
Postfix Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers electronic mail. This is required in order to be able to send mails from the local machine (without using any vendor’s client)
Installation sudo apt-get install postfix Postfix has be configured. The suggested way to do is via: sudo dpkg-reconfigure postfix. You can also directly edit /etc/postfix/main.cf file and make changes to the configuration. For most of the purposes dpkg-reconfigure should suffice.
read more