Blog


Travel Diaries – Bir & Kullu Dusshera: October 2018

The month of September was one of the most relaxing travel months ever. 7 Days in Bir, Asia’s best Paragliding destination, with 2 days in Kullu / Manali attending the Kullu Dusshera, world’s largest Dusshera celebration event with footfall in excess of 4.5 Lakh. The journey started on the evening of 14th October; decided at around 6 PM to leave and was sitting in a Bus to Baijnath at 10 PM, tell me about spontaneous plans.




Generate QR code images in Ruby on Rails app

Create a QR code image along with some content written below it.

Sample Image




Engineers Vs Universe

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Rick CookThe Wizardry Compiled




Automating back-up of your Google Drive on S3

Problem Statement:  I am working with a lot of freelancers for various small creative and content related work but they usually share the completed work as a folder in Google drive. Keep in mind that they are the owner of this folder. After 1 week or so the freelancer is no longer is tasked with us and decides to free up his drive and delete this folder.
I want to mitigate this problem. There are various ways to approach this:
1. Ask the freelancer to transfer ownership and then keep the folder safe.
2.  Download and backup the shared folder whenever you receive a submission.
3. Automate the backing up process as secondary storage.
Of course, ‘automation’ wins, as not only it removes the hassle from both the concerned parties but you have a secondary backup for long-term retrieval and safekeeping as well.

Let’s get to it.

First, set up a VM on Google Cloud, you can use AWS or any other service. I used GC because they have f1.micro(0.6GB Memory, 1 shared vCPU) always free. Not using Google’s Storage because they haven’t added GUI to it, yet.

In the GCP Console, go to the VM Instances page. Launch Instance.
Follow this quickstart guide for starting the VM. https://cloud.google.com/compute/docs/quickstart-linux




List of Youtube channels that I follow and you should too

Below are some of the Youtube channels I follow, educational or infotainment. All of them are Highly Recommended.

Note: Alphabetical order. Description provided by the channel.

 

a16z

73 videos

This is the videos channel for Andreessen Horowitz (aka “a16z”), a Silicon Valley-based venture capital firm that invests in software eating the world.




Gitlab Runner config to auto deploy your static site on S3

If you didn’t know, you can easily setup your static website and host on S3. Just follow these simple instructions and you are done.
https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html

Now you might want to version control your hosted website and would want to avoid uploading this content again and again.
With the help of Gitlab Runner you can simply remove the hassle of uploading your updated code.




Setting up Swap Memory in linux server

Clickbait version: Increase your server’s system memory for free! 😀

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.[src]

Note: Not recommended to be used in production environment. Swap space is very slow compared to physical memory and can seriously affect your application performance.

It’s fairly common to run into “System.OutOfMemoryException” if you are running a memory heavy application or multiple applications on a remote server.  To mitigate this issue you can simply create a Swap space for your server and use your disk space as system memory, this will be a little slower but you wouldn’t have to upgrade your server to higher memory one if you just need some MBs of extra ram or maybe need to perform a single task which needs some extra memory.

To enable 2GB of swap space use the following commands

SWAPFILE=/var/swapfile
SWAP_MEGABYTES=2048

sudo /bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES
sudo /bin/chmod 600 $SWAPFILE
sudo /sbin/mkswap $SWAPFILE
sudo /sbin/swapon $SWAPFILE



Let’s Encrypt (free SSL) on WordPress running on Debian 8

Let’s Encrypt is an amazing service which allows you to add SSL certificates for free on your website. But the process isn’t straightforward if you are running Debian 8. No worries, you can always use the Let’s Encrypt git repo to install the certificates.

Sidenote: You can use this method to install Let’s Encrypt SSL on any OS and for any application.




S3 as outbound mail content storage for Ruby On Rails

“Information is the oil of the 21st century, and analytics is the combustion engine.”

Since Amazon SES and some other email service providers don’t store show you the email content and history, you are left hanging if you want to some historical email performance and analytics. Keep track of outbound emails for Logging, Analytics and Audit purposes by following this simple setup.




TODAY is the first day of the rest of my LIFE!