Author Archives: cyberaka

About cyberaka

My name is Abhinav Anand and I am an ex entrepreneur. I am currently working as a Solution Architect. My roles are managing the team and project design/architecture development. I started working in the year 2001 as a freelancer and developed softwares for local business houses. During this stint I developed accounting, payroll, inventory, institute management softwares for multiple firms. The crowning achievement during this period was Cash Master and Visual Accounts which were highly used by their respective customers. I did this for almost 3 full years and I learnt from experience that it is difficult for a single person to design big product although you have more control but you are limited to your talent only. You need preferably a small talented team if you want to do anything big. From 2004 I started working in process automation and visualization (HMI) related software. This was a rewarding experience and I developed core competence at many interesting concepts and technology. I got a great deal of experience in team based development and got a very knowledge rewarding technical sales support experience. It is unfortunate that the company I work for and the company for whom they designed the product have both closed their business within 4 years of my leaving. I did this for around 3 years and I learnt from this experience that you cannot focus on a single customer and grow. As a consulting firm you have to hedge your risk on multiple customers and accounts. Whereas as a product firm you need to have a very solid financial backing to break into a market and keep yourself afloat. The most important lesson I personally learnt was to keep clear of products which take better portion of a decade to become successful. From 2007 onwards my focus narrowed down to mobile and web integrated projects. I worked on multiple projects in J2ME (Symbian, Blackberry) and Android. I saw Android’s first release and I loved the power it gave to developers in comparison to iPhone ecosystem. I think the coming of Android changed the game and gave way to the opening up of the iOS development environment to average joe developer. I knew the coming decade was going to be a mesh of mobile and web based solution. The future is all about combining consumer electronics and software for a compelling product. From 2010 onwards I finally got fully involved with my own venture and my focus was developing Android and iOS apps. My goal was to be identified as a dependable mobile based product maker with a solid portfolio of mobile based software. Till date my company has developed Blackberry, iOS and Android apps in variety of small to medium domains. From 2014 onwards I got back into a Job and shutdown my venture. I did this as I had become bored and wanted to work in a bigger team and project. I worked for a while in a Big Data analytics company. Finally I moved to a new company which wanted me to hire a team and write a Retail ERP software from scratch. It has been a very challenging experience and I had to relearn a number of things to get things done. I am still not fully done with this ERP but the end is in sight. It has been a very rewarding experience to work with AngularJS, Spring Boot, Docker, Mockito etc. which were totally new to me. But the technology choices have paid back handsomely.

ssh_exchange_identification: read: Connection reset by peer

I recently upgraded my Mac Desktop and I noticed a strange problem that I was not able to SSH into my desktop from my laptop. I ultimately found out that the SSH setup that came with MacOS was having some issue as when I did ssh user@localhost on the desktop I got the same error:

ssh_exchange_identification: read: Connection reset by peer

I ended up tailing the system log using the following command:

sudo tail -f /var/log/system.log

I observed the following entries in the log whenever a SSH was attempted.[1] (com.openssh.sshd.[UUID][NUM]): Service exited with abnormal code: 1

It was clear that there was setup issue with the SSH that came with default MacOS installation. So I decided to spawn a separate SSH instance and watch it’s log:

sudo /usr/sbin/sshd -d -p 2222

This command showed up a lot of issues related to file permissions.

Permissions 0644 for '/etc/ssh/ssh_host_dsa_key' are too open.
Permissions 0644 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
Permissions 0644 for '/etc/ssh/ssh_host_ed25519_key' are too open.

I fixed these permission issues by changing their permission to 400:

sudo chmod 400 /etc/ssh/ssh_host_dsa_key
sudo chmod 400 /etc/ssh/ssh_host_ecdsa_key
sudo chmod 400 /etc/ssh/ssh_host_ed25519_key

After this change the following command succeeded and I was able to do successful SSH connection to port 2222.

sudo /usr/sbin/sshd -d -p 2222

So I killed this process and decided to restart SSH:

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist 
sudo lsof -i:22
echo $?
sudo launchctl load /System/Library/LaunchDaemons/ssh.plist 

Once SSHD was restarted I could successfully do logins using ssh user@localhost from Desktop as well as remote login via SSH from my laptop. 

Prettify JSON on Terminal

I love using curl command on my Mac terminal to debug my REST endpoints. However the REST call JSON output used to come in a blob of text which required further formatting in an Editor like Visual Studio Code. To allay this problem I ended up installing “jsonpp” using homebrew.

brew install jsonpp

So now I just pipe the output of my curl command to the jsonpp program and I get a fully formatted JSON.

$ curl http://localhost:8080/test | jsonpp
"year": 2018,
"month": 2,
"worked": 18,
"leaves": 2



Curl Command New Line Post Output

I like to use curl instead of UI tools like Postman for debugging my RESTful web services traffic whenever possible. I however didn’t like my output being messed up by the bash prompt being suffixed to the output. Something like the following:

$ curl -H "$auth_token" http://localhost:8080/xyz/abc-efg

So basically what I needed was to have a new line forced after the curl output. A quick search on internet yielded this article. So I executed the following command on my terminal.

$ echo '-w "\n"' >> ~/.curlrc

After doing this when I execute the same curl command I get the following output.

$ curl -H "$auth_token" http://localhost:8080/xyz/abc-efg

So now the bash prompt is actually coming on a new line by default!

Validating Signature in PDF documents in Acrobat Reader

I received a digitally signed document from a trusted source. However when I proceeded to take a print it came out with “Signature Not Verified” in place of the signature field. This was not going to work so I did some googling and found out this link. It basically allowed me to validate the signature and take a printout with “Signature Valid” in place of the digital signature.

Triggering download of file using JavaScript

I recently needed to write a small piece of download code. So you pass in the ID of the document to a REST API and it should give you back a blob of the actual file. The problem however is how to actually save this blob of binary data into a local file. So a quick Googling threw up some interesting links which I finally used to finalize my solution.

Code to detect file name

Code to trigger download