As software craftsmen, one of the most common things we do on a daily basis is debug our code. When using docker, be it locally or on cloud, a lesser known, yet incredibly powerful tool available to us is
Quoting from the docker docs.
docker attachto attach your terminal’s standard input, output, and error (or any combination of the three) to a running container using the container’s ID or name. This allows you to view its ongoing output or to control it interactively, as though the commands were running directly in your terminal.
Most programming languages have debuggers that allow you to halt execution at specific points by defining break points in your program at which point you can inspect the current state of the program. From there you could either go step by step or continue execution until instructed to halt again at some other code path or the program exits. This is a very commonly used approach for debugging your application and allows the developer to be able to inspect the exact state of program at key points to determine if it’s behaving as intended or not. …
The COVID-19 pandemic has forever changed how we work. Even after this nightmare is over, which I am hoping is very soon, it has forever changed how we collaborate with each other.
I have been predominantly working from home for the last 10 years and have been a huge proponent of it because of 2 main reasons :
I am a fan of Direnv, however when I wanted to add custom project specific aliases and other helper functions etc, I soon came across https://github.com/direnv/direnv/issues/73. There are some good workarounds proposed to address this issue, but none of them felt clean to me. There also exist alternatives that offer similar solutions but why waste time if it can be better spent building something quickly yourself. So I considered rolling out something basic on my own. This is what it looks like :
The idea here is fairly straight forward, I can add 2 special files to a project directory,
.zshrc.exit and these will get loaded once I enter / leave the directory in zsh shell respectively. This allows me to add project specific custom functions / aliases etc within the
.zshrc.enter and clean them up in
.zshrc.exit so when I move out from the project directory they are no more cluttering my global configuration. …
It’s convenient to use readily available configuration frameworks, they provide a huge bang for your buck by saving you a lot of time and effort while making your shell experience pretty awesome.
However, this convenience comes at a cost and the more plugins you enable, the more tools you use, they all add up and make ZSH sluggish, especially during start up.
Today I will introduce you to a few tricks I use to measure and profile ZSH. I will also benchmark different setups for their start up times for a comparison.
NOTE: All scripts I use today are available within my dotfiles/zsh repository. …
By now you know the how powerful SSH is, here I will show you how you can make use of ssh config instead of the command-line flags, to simplify your life. This is especially useful if you use ssh frequently to connect to multiple servers.
Quoting from the
ssh_config manual :
ssh(1) obtains configuration data from the following sources in the following order:
1. command-line options
2. user’s configuration file (~/.ssh/config)
3. system-wide configuration file (/etc/ssh/ssh_config)
While, it’s perfectly fine supplying all the ssh options via the command line, it’s quite cumbersome and requires an unnecessary amount of typing. As developers, it’s our duty to abhor unnecessary typing and we should feel obligated to automate. …
Quoting SSH man page to remind us all to check them more often.
ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to provide secure encrypted communications between two untrusted hosts over an insecure network.
Most developers spend a considerable amount of their time ssh’d into remote machines, however, few are aware of the power of ssh tunnels or what they even are.
SSH Tunneling, is the ability to use ssh to create a bi-directional encrypted network connection between machines over which data can be exchanged, typically TCP/IP. This allows us to easily & securely make services available between machines with minimal effort while at the same time leveraging ssh for user authentication and encryption with little to no overhead. …