Riyadh Al Nur - Full-Stack Software Engineer https://verticalaxisbd.com/ Recent content on Riyadh Al Nur - Full-Stack Software Engineer Hugo -- gohugo.io en-US Tue, 14 Dec 2021 23:30:47 +0800 Setting up Falco on Kubernetes (Part 1) https://verticalaxisbd.com/blog/real-time-threat-falco-k8s/ Tue, 14 Dec 2021 23:30:47 +0800 https://verticalaxisbd.com/blog/real-time-threat-falco-k8s/ Falco is a CNCF incubated project that provides real-time threat detection for your Kubernetes clusters. In part 1 of this post, we will go through setting up Falco on your K8s cluster. Any rules triggered will be posted to a webhook URL but Falco can be configured to send events to a number of other providers; the full list can be found here. Setting up We will be using DigitalOcean’s Managed Kubernetes service to set up our. Managing media on WhatsApp for Business https://verticalaxisbd.com/blog/whatsapp-business-prune-media/ Thu, 28 Nov 2019 15:15:00 +0800 https://verticalaxisbd.com/blog/whatsapp-business-prune-media/ If you happen to run be running a WhatsApp for Business instance, you might run into storage issues without regular maintenance like we did, recently. A few weeks ago, outgoing messages were logging a failure while trying to download media. From their documentation - Media storage needs to be handled by the business. If the media volume gets full, message sending will start to fail. Luckily, we have a fallback to textonly versions of messages for when images are not available to be downloaded for one reason or the other. Code Splitting in Go https://verticalaxisbd.com/blog/code-splitting-go/ Sat, 30 Dec 2017 17:48:22 +0800 https://verticalaxisbd.com/blog/code-splitting-go/ In Go, all code revolves around the concept of packages. In this post, I’ll go through splitting code across the same package in Go. Essentially, if multiple files share the same package name, all exported functions share the same scope. This means we don’t need to use import to use any of these functions. To demonstrate, create a file name hello.go - package main import "fmt" func SayHello() { fmt.Println("Hello there! Oops, no internet https://verticalaxisbd.com/offline/ Fri, 15 Sep 2017 23:28:14 +0800 https://verticalaxisbd.com/offline/ Projects https://verticalaxisbd.com/projects/ Fri, 15 Sep 2017 23:28:14 +0800 https://verticalaxisbd.com/projects/ More Security Using Domain Filtering https://verticalaxisbd.com/blog/more-security-using-domain-filtering/ Thu, 16 Feb 2017 18:53:12 +0800 https://verticalaxisbd.com/blog/more-security-using-domain-filtering/ Most systems, if not all, need to use/does use some form of domain filtering for security. In my case, I needed to check against unauthorised usage from domains other than ones whitelisted by clients from their dashboard. This is definitely a necessity if your clients are going to be embedding your code into their sites. It keeps both parties safe from attacks. The solution I came up with is pretty simple. Managing and Deploying NodeJS Apps With PM2 https://verticalaxisbd.com/blog/managing-and-deploying-nodejs-apps-with-pm2/ Tue, 05 Jul 2016 18:48:20 +0800 https://verticalaxisbd.com/blog/managing-and-deploying-nodejs-apps-with-pm2/ I use PM2 as the process manager for my NodeJS apps in production and staging servers among others. PM2 now has a deployment pipeline built-in but the documentation is a bit underdone in my opinion. So after, digging around in the code and documentation, I pieced together this guide to get you started on using PM2 not just to manage your NodeJS apps, but deploy them to servers as well. Setting Up WiFi on Raspberry Pi 2 https://verticalaxisbd.com/blog/setting-up-wifi-on-raspberry-pi-2/ Sun, 22 May 2016 18:44:38 +0800 https://verticalaxisbd.com/blog/setting-up-wifi-on-raspberry-pi-2/ TL;DR I recently purchased a Raspberry Pi 2 and picked up a WiFi adapter from TP-Link to go with it. Naturally, my aim is to be able to SSH into my Pi and not have a screen connected to it at all times. As seen in the image at the beginning of this post, the only wire I have connected is the power cable (I have wiring OCD). I installed Ubuntu Snappy Core. SEO in AngularJS Apps With PhearJS https://verticalaxisbd.com/blog/seo-in-angularjs-apps-with-phearjs/ Wed, 04 May 2016 18:37:30 +0800 https://verticalaxisbd.com/blog/seo-in-angularjs-apps-with-phearjs/ Whether you like it or not, single page applications (SPA) are all the rage and if you use AngularJS, then SEO has to be one of the main pain points when building an application. Except for Google, makes sense since they built Angular, no other external service can render JavaScript applications properly. If you are using React, you might want to read this too because unless you use server-side rendering, bots will not be able to render your site properly. The chronicles of HTML5 mode - NodeJS, AngularJS and NginX https://verticalaxisbd.com/blog/nodejs-angularjs-and-nginx/ Mon, 01 Feb 2016 18:35:18 +0800 https://verticalaxisbd.com/blog/nodejs-angularjs-and-nginx/ Normally, building an Angular application with an ExpressJS server powering it would be straight forward and it is but problems creep in if when you deploy it to your NginX backed server, like I found out the hard way. Generally, there are 2 ways to serve an Angular app - Example 1 app.get('/api/user', user.get); // your api endpoint app.get('*', view.index); // let angular do the rest Example 2 app.get('/api/user', user.get); // your api endpoint app. Delayed Published Posts in KeystoneJS https://verticalaxisbd.com/blog/delayed-published-posts-in-keystonejs/ Sun, 31 Jan 2016 18:32:13 +0800 https://verticalaxisbd.com/blog/delayed-published-posts-in-keystonejs/ It goes without saying that having the ability to schedule posts is somewhat of a must-have functionality in a CMS - at least that’s what I’ve noticed or heard. Before I begin, note that this is a poor man’s implementation of a post scheduler. In my opinion, it is not scalable and should not be used if you have 50+ people scheduling posts at any given time. This way of doing things does have the benefit of not having to poll the system every minute or so depending on how accurate you would like your workers to be. Using Let's Encrypt to Secure Your Site https://verticalaxisbd.com/blog/using-lets-encrypt-to-secure-your-site/ Mon, 07 Dec 2015 18:29:40 +0800 https://verticalaxisbd.com/blog/using-lets-encrypt-to-secure-your-site/ Now that Let’s Encrypt is in public beta, you can go ahead and secure all your websites and move one step closer to making the web a more secure place. At the time of writing, automatic configuration for Nginx is still in development, so it’s a better idea to generate the certificates manually and place them manually in the configuration for your servers in Nginx. To get started, SSH into your server and clone the letsencrypt repository a folder of your choosing and fire up letsencrypt. Enforcing HTTPS for NodeJS apps behind an ELB https://verticalaxisbd.com/blog/enforcing-https-for-nodejs-apps-behind-an-elb/ Mon, 31 Aug 2015 18:27:04 +0800 https://verticalaxisbd.com/blog/enforcing-https-for-nodejs-apps-behind-an-elb/ This weird problem came to be when I was trying to enforce HTTPS for a NodeJS application running behind 2 ELBs (Elastic Load Balancers) on AWS. The NodeJS application in question had sockets running for real-time communication with the client. The ELBs were configured to listen over TCP for HTTP and SSL for HTTPS and redirect to the NodeJS app listening on port 3000. Sockets need to connect over the TCP/SSL layer if you are wondering. Inheritance with MongoDB and Mongoose https://verticalaxisbd.com/blog/inheritance-mongodb-mongoose/ Sat, 30 May 2015 18:22:00 +0800 https://verticalaxisbd.com/blog/inheritance-mongodb-mongoose/ I use Mongoose - the ORM for MongoDB, everyday, and there’s one thing in Mongoose, I find very extremely useful - discriminators. In a nutshell, it’s inheritance of database models but the documentation for it has a lot to be desired. I was working on a model that made use of discriminators and like before, I thought it would be easy sailing but I found that populating child fields from the parent/base schema was not possible with the version I was using and after a lot of Googling and after sifting through the tons of issues on GitHub, I found that it was introduced in the latest release. Database Migration in NodeJS and MongoDB https://verticalaxisbd.com/blog/database-migration-in-nodejs-and-mongodb/ Thu, 19 Mar 2015 18:18:22 +0800 https://verticalaxisbd.com/blog/database-migration-in-nodejs-and-mongodb/ The problem We have an app running on the MEAN stack and are using MongooseJS as our ORM. Now, we have 2 collections event and eventV2. We are looking to drop the event collection and rename the eventV2 collection to just event. The solution This means running a migration script and fortunately for us, mongoose can connect to MongoDB directly and let us use Mongo’s native methods. We’ll be using the dropCollection and renameCollection methods. Opinionated Look at Error Handling in NodeJS https://verticalaxisbd.com/blog/opinionated-look-at-error-handling-in-nodejs/ Sun, 08 Feb 2015 18:15:35 +0800 https://verticalaxisbd.com/blog/opinionated-look-at-error-handling-in-nodejs/ I came across pieces of code in the app codebase I work on quite a few times which seem wonky, to say the least. In an event that there’s an error, a callback should return the error object and only the error object. The code, in question, I’m talking about goes something like this - if (error || !user) { return callback(error); } Now, in this scenario, if the user object turns up null for some reason, you are essentially returning a callback containing a blank error object which serves no purpose. Extending Lo Dash With More Methods https://verticalaxisbd.com/blog/extending-lo-dash-with-more-methods/ Thu, 15 Jan 2015 18:12:37 +0800 https://verticalaxisbd.com/blog/extending-lo-dash-with-more-methods/ Lo-Dash is the go to JavaScript utility library for any project, atleast for me. Whats really cooler is that you can extend it with more methods if the ones already available are working out for ya. The creators of Lo-Dash made sure to build a method in to the library to do just that. I’ll be extending the library to create a method that returns a random element from an Array. Using Async Queue in Your NodeJS Apps https://verticalaxisbd.com/blog/using-async-queue-in-your-nodejs-apps/ Sat, 13 Dec 2014 18:06:55 +0800 https://verticalaxisbd.com/blog/using-async-queue-in-your-nodejs-apps/ The ‘async’ library is probably one of the top ten packages you install when you start working on a NodeJS application and for good reason too. The library lets you write asynchronous code without all the boilerplate code out of the box. I, personally, have a few favourites functions that are a must have in any code I work with - the waterfall, parallel, each, series, and the apply. Recently, I tried out the queue function and I literally felt like a 10-year old kid again who just got a new video game. Redirection to Requested URL After Login in NodeJS https://verticalaxisbd.com/blog/redirection-to-requested-url-after-login-in-nodejs/ Mon, 14 Jul 2014 18:00:35 +0800 https://verticalaxisbd.com/blog/redirection-to-requested-url-after-login-in-nodejs/ While working on an app built on NodeJS, I was faced with a problem where users would be redirected to the homepage after successful login even though they had requested a different URL, contained in the mail they would receive. The solution was obvious but trivial given the size of the app itself. Changing routes for the login process was not a solution since almost the ful lapp was depenedent on these routes. Choosing a CMS for My Site https://verticalaxisbd.com/blog/choosing-a-cms-for-my-site/ Fri, 04 Jul 2014 17:57:03 +0800 https://verticalaxisbd.com/blog/choosing-a-cms-for-my-site/ This dilemma of mine has been gnawing at me for a while now. When I decided to give my personal site an overhaul, I was left with the tough decision of making a choice of CMS to power it. A year on, my site still has an ‘Under Construction’ sign. I have made harder choices in life in this time! Initially, I thought I would go with what I was comfortable with since I had been developing on it for a while now and I knew the ins and outs. Kick Ass Contact Form With Jquery and Mandrill App Only https://verticalaxisbd.com/blog/kick-ass-contact-form-with-jquery-and-mandrill-app-only/ Tue, 18 Feb 2014 17:51:31 +0800 https://verticalaxisbd.com/blog/kick-ass-contact-form-with-jquery-and-mandrill-app-only/ Don’t get me wrong, I don’t hate PHP but it’s always nice to have new libraries or frameworks that make life that bit easier. Before, I used PHP and jQuery to write contact forms on websites where PHP would handle the sending and jQuery with the interaction, validation and AJAX functions obviously. Recently, I stumbled upon an article on Medium that teaches you how to get started with Mandrillapp.com which lets you send emails using their API. Install Nexus 5 Launcher on Your Android Phone https://verticalaxisbd.com/blog/install-nexus-5-launcher-on-your-android-phone/ Mon, 10 Feb 2014 18:44:27 +0800 https://verticalaxisbd.com/blog/install-nexus-5-launcher-on-your-android-phone/ I have been waiting for this ever since KitKat was released in October, 2013. My phone manufacturer has kept mum about a possible upgrade to KitKat but with this APK, you can get the Nexus 5 launcher on any Android phone. I currently run Android Jellybean 4.2.1. Here are the steps to get the new launcher on your phone: Download the .apk by clicking on this link: APK. Syncing 2+ Ubuntu Servers With Unison https://verticalaxisbd.com/blog/syncing-2-ubuntu-servers-with-unison/ Thu, 23 Jan 2014 18:38:40 +0800 https://verticalaxisbd.com/blog/syncing-2-ubuntu-servers-with-unison/ When running a load-balanced site with 2 or more data servers, it’s important to keep them in sync as I have found out the hard way. Initially, I used rsync (the default sync tool in Ubuntu) but it turned out to be complicated and not the right fit. It was okay to have one of the servers as the master which would sync with the the slave but things got wonky when data was being written to the slave server and changes would not be reflected in the master. Using W3 Total Cache With Wordpress on Nginx https://verticalaxisbd.com/blog/using-w3-total-cache-with-wordpress-on-nginx/ Thu, 12 Dec 2013 18:32:22 +0800 https://verticalaxisbd.com/blog/using-w3-total-cache-with-wordpress-on-nginx/ This post assumes you have already installed the following applications. If not, you can check out the articles on how to set them up - How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04 How To Install Wordpress on Ubuntu 12.04 About W3 Total Cache W3 Total Cache improves the user experience of your site by increasing server performance, reducing the download times and providing transparent content delivery network (CDN) integration. 3 Things to Remember When Dating a Programmer https://verticalaxisbd.com/blog/3-things-to-remember-when-dating-a-programmer/ Sun, 24 Nov 2013 18:28:47 +0800 https://verticalaxisbd.com/blog/3-things-to-remember-when-dating-a-programmer/ Face it ladies. Nerd is the new sexy! These few pointers will hopefully help women in keeping their patience when dating a programmer. It’s not really our fault. We just love what we do! We phase out You might think we are not interested to talk most of the time but actually we are just thinking of how to solve a coding problem. Very rarely will you see us taking a load off and enjoying the moment but even then we will take a few minutes to get our head around a problem. How to Add New Relic Monitoring for Ghost https://verticalaxisbd.com/blog/how-to-add-new-relic-monitoring-for-ghost/ Wed, 13 Nov 2013 00:51:13 +0800 https://verticalaxisbd.com/blog/how-to-add-new-relic-monitoring-for-ghost/ New Relic just added Node.js applications' monitoring a few days and perfect timing too! With Ghost just being released, New Relic is the perfect tool to keep an eye on how your Ghost blog installation is performing. This tutorial assumes the obvious that you already have Node.js and Ghost running on your server. To turn on monitoring, visit your New Relic account and in your ‘Applications’ panel and click on ‘Get Started’. Add Disqus Comments to Your Ghost Blog https://verticalaxisbd.com/blog/add-disqus-comments-to-your-ghost-blog/ Sat, 02 Nov 2013 01:41:50 +0800 https://verticalaxisbd.com/blog/add-disqus-comments-to-your-ghost-blog/ As we speak, Ghost still does not have a commenting system in place. A blog feels incomplete without a comments' section. Fortunately, you can add the Disqus to your blog. Head on over to the Disqus website and create an account if you already haven’t. Click on the “Add Disqus to Your Site” button to get started. Once in the page, fill in the necessary details. The first field is important.