Image for post
Image for post

I have been following Elixir/Phoenix for some time now and finally got to work with elixir with a slack bot UltronEX and it blew me away how performing it was compared to Ruby. During this time Phoenix LiveView was gaining traction. Which got me excited but I needed something to built to play with it and that is when I came across this post about Building a Smart Mirror with Phoenix LiveView. This gave me some motivation and idea to do of my own. So during this 2020 pandemic when the world was all holed up indoor I bought a Raspberry Pi 4 and build an Ad blocking VPN with DNS over HTTPS on a Raspberry Pi4. …


Image for post
Image for post

Elixir has seen fast adoption in Wego with multiple services already in production after the weekend project UltronEx became a daily driver for monitoring real time data it has spurred a movement to explore new options and build robust resilient systems.

As We run almost all our work loads in containers we take advantage of the same build pipelines for building container images to run CI/CD as well. Elixir runs on BEAM and has some nice features such as hot redeploys that is something anti to the concept of containers where they are immutable images none the less it does not mean Elixir is not container friendly. Mix, the elixir build tool similar to what Rake is for Ruby and has great support to generate a bundle with ERTS called a Release that you can take and run anywhere as long as it is the same platform it was built on. This is what works really well with containers keeping the image size significantly small without any external dependencies. Even though this makes the Elixir Release easy to work with it also strips it of its tool chain that you require to perform actions such as running migration or executing tasks as there is no Mix available in a Release. …


Upcycle your old laptop don’t throw it away

Image for post
Image for post

So i bought hp dm3000-ea beats edition in 2012-2013 my 2nd laptop ( 1st one was gifted to me by my dad on graduating) this was probably the most expensive thing back then out of my pocket ever
تب احساس ہوا عیاشیاں تو باپ کے پیسے سے ہوتی ہے اپنے سے تو صرف ضرورتیں ہی پوری ہوتی ہیں
So been using it till last year, after over 6 years of use it finally "died" on me. Before this in 6 years its RAM had degraded over time and had upgraded it from 3GB to 16GB which had degraded again and were up for replacement. Also the HDD had crashed 4 years ago and replaced it from 256GB to 1TB. So it was maxed out over time but then came its time the WiFi started failing and then the fan gave in and it "died" إِنَّا لِلّهِ وَإِنَّـا إِلَيْهِ رَاجِعونَ . As دنیا گول ہے then I bought the most expensive thing of my life hp Spectre x360.
کیونکہ لندن تو کیا میری تو سنگاپور میں بھی پراپرٹی نہیں یہی اوقات ہے ٹیکس پیئر کی۔
Being Pakistani a natural master in hoarding it has been kept well given its own space to honour its services over the years. New laptops don’t come with CD-ROMs now and having a portable storage is a must for we live in a digital age and being a software developer a single screen isn’t enough at times to work. As I was contemplating buying all of these I recalled having my prize buy lying around, my first thought was I can take the HDD out and make an external HDD of it (had done that with the old HDD already). Then I searched to see if I could get a case for CD-ROM and walla there it was and boom an external CD-ROM could also be made. Now for the last item a secondary screen for which I Google-d and there were a ton of articles and videos over how an old laptop LCD could be converted to an external display all l needed was a LCD controller board for my model and a 12V/3A power adapter, so ripped the old gun apart and searched for the LCD controller board on Ali Express. It being an old model still managed to find a couple of suppliers for it. Ordered all the items that cost me for an external HDD case (10 SGD) external CD-ROM case (9 SGD) LCD Controller board (27 SGD) power adapter ( 6 SGD) a total of 52 SGD. Had I bought all these Items it would have cost me somewhere between 300-500 SGD. If you have read it this far I hope it helps you in recycling your old electronics or upgrading your laptop to extend its life. Don’t waste money think before you throw away your old gadgets. …


Ad blocking VPN with DNS over HTTPS on a Raspberry Pi4

Image for post
Image for post

I recently bought a Raspberry Pi4 with just an idea of setting up an OpenVPN node for fun. Once it arrived it felt like a COVID19 impulse buy 😅 when I could have gotten an instance in cloud for as low as 4 SGD and use it for almost 3 years to break even the cost. So I started exploring what more could I do, while doing more and more DuckDuckGo searches I realized I could set up an Ad blocking DNS using PiHole. As there is now the hype of DoH — DNS over HTTPS, so I explored if I could do that and yes there was a way OSS FTW. Once I settled on Pi hole and cloudflared for an Ad blocking DoH for home network, I wanted to setup a VPN which would not just be a VPN but an Ad blocking VPN. I have been using and advocating ppl to use Blokada to run a localhost VPN and block ads on their devices and I do that on my mobile, tablet and even TV but when I had to use a VPN and turn off bloakda there would be a wave of #Ads that would hit me. My initial pick was based on the most commonly known option OpenVpn but turns out the Raspberry Pi4 doesn’t have the power to do crypto efficiently but I thought it was a compromise worth making that is when I stumbled across WireGuard protocol the new kid on the block which is simpler and faster and less resource hungry than OpenVpn and simpler to setup also 😅. Once settled on all the components it was time to set them up on the Pi and setup some port forwarding on the router. God bless Docker as I didn’t wanted to install each of these and run into dependency pains on ARM64 architecture. Hooked it all using Docker Compose and now I have a VPN that has Ad blocking built in and at home a WiFi that blocks all ads on my devices. The biggest win of running the VPN from home is the residential IP I get as most of the VPNs use data centers that give limited speed and bandwidth and have a bad reputation and are blocked by service providers. It feels like an achievement 😂 so will put out the repo for anyone to be able to run this setup at home and #ReclaimYourInternet. Yes there are plenty of tutorials over how to set them up but not all 3 together so it takes some effort to know what you have to do. I know ppl would think can just install a plugin such as Adblocker in broswer and get done with it at home but then again they are collecting all the data its just that they sell it "anonymised". Block them at the source and protect your data. The results are pretty decent, the latency is lower and the upload speeds are similar on the VPN. Overall its a win win utilisation of the Pi4. …


Image for post
Image for post

Ruby gets hammered a lot for its green threads and no real concurrency yet Ruby libraries such as Resque, Delayed Job and Sidekiq are some of the most popular choices to run background jobs in the industry. When you have a huge project and millions of requests and hundreds of thousands of operations to perform, reach out to one of these solutions which are feature complete and you don’t have to reinvent the wheel as its complex piece of software to implement and requires thousands of human hours. While they help you scale sometimes they are not what you are looking for or need as they are meant for a scale of 10000s of jobs per second and what you need is a background processing for few jobs that can be handled in memory without a dependency of a queue such as Redis. …


Image for post
Image for post

We all have dabbed command line once or twice. Using terminal to run commands makes you feels like super human when there is no GUI.


Image for post
Image for post
Architecture Diagram generated from repo source

This is going to be a long post. You can skip to the Design section if you don’t want to go through some background history of the project.

This was my first time writing Scala almost 6 years ago(and the last time for a project of this scale). Back then the word around was that Ruby is going to get obsolete as Rails is losing its charm after setting the web development world on the path of convention over configuration. …


Image for post
Image for post
Dashboard

What started as an Elixir project over the weekend to support our mobile team with their QA. UltronEx grew into the playground to have introduced many new things to our stack including elixir. The initial design of the project upon which this was built to provide additional support for the QA was stream messages directly into Slack. It soon hit limit on the Slack side with calls being rate limited. This caused thousands of messages not being delivered to Slack for QA to work with. We were getting hundreds of event types rate-limited some over 10000 times since the project. One way would have been to retry but in a stream system you are only queuing messages again to fail and when a message is delayed or out of sequence it loses its value. …


This is a follow up to the earlier post Dev to Deploy; Cloud Native Stack Part-1 . In this post I will walk through on how to provision on Hetzner a server in cloud using Terraform and have a preconfigured snapshot built using Packer to have it ready with your configuration.

Sign up for an account on Hetzner if you don’t have one and then setup a project on it. I have my project UltronEx on it. Once you have the project created add your public SSH in the access section. …


This post is build up on my previous post about Ultronex, a slack bot rewrite in Elixir. In this post I will walk through how a simple slack bot expanded to include an API, reverse proxy , container monitor and log management solution all on a cheap Hetzner VPS using cloud native tech Terraform, Packer, Ansible and Docker. If you have gone through the original post you would know that Ultronex was packaged as a container for easier development and it helped me to move my locally developed code to cloud and not expect any nasty surprises doing deployments manually. I will walk through the components of the app and how they were implemented and how they work together using docker-compose . …

About

DAR

Coder during the day, squash player in the evening and cricketer over the weekends. Doubts are the ants in the pants, that keep faith moving

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store