Posts
Remote control your Linux Workstation (Efficiently)
· β˜• 4 min read · πŸ€– Naresh Mehta

There are many different solutions to remote control your Linux workstation but most of them are not effective. For example, one can always ssh into the workstation and forward X. Well, this kind of works but has several drawbacks; the major one being that all the processes you started with your ssh session will be killed when you loose your SSH session. I call nohup, screen, etc. as bypass methods because they essentially try to give you a workaround solution instead of actually solving it. And if you are like me who keeps logging in and out and starting/stopping scripts, I am pretty sure you will forget to use those just like me and login after a good night sleep to find out that your compile script got terminated because you forgot to screen it! Also, SSH with X forwarding typically needs an X-Server on your host machine and can be a PIA to setup if you are on Windows. Yes, yes, we can all use MobaXTerm but hey, believe me, X-server is heavy in terms of resource usage on Windows. Also automatic file changes are not detected with that solution.


Tensorflow mnist_deep.py OOM error when running on GPU!
· β˜• 3 min read · πŸ€– Naresh Mehta

I know you are interested in #MachineLearning and your first instinct is to use #TensorFlow (of course since it is backed by #Google) and you will probably find a lot of support with queries. The best part is that the available #Docker container will help you experiment and it simply runs out of the box. Look at my article on getting started with Tensorflow. Soon you will get bored by the amazingly slow executing speeds on CPU and will be thirsty to run it on your GPU because:


Automate Your Twitter with a BOT!
· β˜• 3 min read · πŸ€– Naresh Mehta

We all have Twitter accounts and we all tweet stuff. But sometimes, we all suffer from information overload. And we all need to get more followers right? So one of the things we can do is automate Twitter posts using a tweet bot. I am using nodejsΒ as my framework (simply because it works for webapps pretty good). You can search on the web to understand how to install nodejs and npm. Use the latest version and it should work fine. I am also using a Twitter API client for nodejs known as Twit. Twit is a very simple library that wraps all the twitter APIs in easy to use function calls. The code is pretty straight forward as can be seen below.


Simulate 100s of clients in Meteor
· β˜• 2 min read · πŸ€– Naresh Mehta

Meteor is a subscribe publish based application development framework which allows for rapid application development using the same code base. I had the chance of working on one of the most demanding meteor applications ever written. The client is a high profile company working with automation. So basically one of the problems they faced was to simulate tens of thousands of devices in a virtual environment. One of the most logical ways to go would be to dockerizeΒ the client and then use docker swarm mode to auto scale the clients. But the code base right now is a monolith and hence dividing the different functionality into micro-services isΒ doable but will take a long time. The client wanted this done like the day before I got my hands dirty.


Machine Learning - Baby Steps
· β˜• 4 min read · πŸ€– Naresh Mehta

Machine learning (ML) is the “FUTURE”. I have been reading about it for quite some time now and I am pretty convinced by the statement. We are all talking about BigData, predictive analytics, etc. but really, when a system dude like me tries to foray into the field of ML, everything seems so overwhelming. The discussion starts with having millions of records (if you are lucky). Otherwise, it is 4TB of unstructured data as a start. Your systems brain tries to grasp the big picture and gets lost in trying to figure out the details. But well, after reading around, grappling, experimenting and reading a bit more, I think that learning ML is doable for us system dudes. You do not have to be a math genius (well, it helps if you are). But I will start with this blog of mine documenting the baby steps needed. I will use it as my reference and you can use it as yours if you find it useful.


Print a singly linked list in reverse!
· β˜• 2 min read · πŸ€– Naresh Mehta

Today’s topic is pretty simple. Let’s print a linked list in reverse. And it is a singly linked list meaning you can only traverse in one direction and not come back. You are only given a pointer to the head. So without further ado, below is the c++ code. Only the important parts are shown. Rest is left as an exercise for the reader to create a fully working program.


Backward Compatibility!
· β˜• 4 min read · πŸ€– Naresh Mehta

Backward Compatibility

The internet is littered with articles on backward compatibility and why it is important and rants of people who work/use 1970s systems on the same. Well the last sentence there was a pun but people do rant on not being able to use the PS2 games on PS4 and or not being able to use Lint with the new c++11 or c++14 features or sticking to an outdated kernel (2.6.36) and not being able to use the new virtual environment enhancements, etc. Finally, all of these rants boil down to, “Everything should be backward compatible and should not break existing systems”.


Basic use of Tuples C++11
· β˜• 2 min read · πŸ€– Naresh Mehta

Basic use of Tuples in C++11

Tuples are an amazing feature in C++. Tuples are specified inΒ C++11 standard (ISO/IEC 14882:2011), i.e. they are a new introduction in c++11. So if you are more used to traditionalΒ c++, tuples will come as a surprise for you. It happened to me as well and I am not that old (quite yet)! They are a great addition to generic programming and brings C++ to a whole new level of usability. Of course we have had ways to do exactly the same things that tuples does but now that it is a part of the standard language, it makes sense to use this feature instead of cooking something of our own. I see tuples as an important feature like dictionary in python (more or less). Tuples are amazing and you can feel the power when you start using them. Auto types and tuples make a great combination for very nice cool features previously rarely thought of (multiple return values from a function anyone). Anyways, I don’t see people really appreciating the flexibility being provided by our beloved language. Stefan Lavavej (@StefanTLavavej) maintaining the STL implementation, working at @microsoft, has a very nice talk in CPPCon 2016 that I recommend you watch. Check it out below. This is the one that got me interested in tuples.