Year: 2022

  • How to resize and crop an image using Typescript

    How to resize and crop an image using Typescript

    In this article, I will share a simple snippet in Typescript, that you can easily convert to Javascript, to resize and crop images without relying on any third-party libraries. This code snippet first prompts you to select a local image using an HTMLInputElement. Once an image is selected, using the FileReader API, it loads the […]

  • Kubernetes Commands Cheat Sheet

    Kubernetes Commands Cheat Sheet

    This is part of my Kubernetes cheat sheet. How to restart a Pod in Kubernetes I often want to restart pods without actually having to deploy anything. It can be done quite easily with the kubectl command. To restart a Kubernetes pod, you just need to: How to delete evicted Pods from a namespace This […]

  • Python Selenium Webdriver.implicitly_wait(seconds)

    Python Selenium Webdriver.implicitly_wait(seconds)

    This method configures the Python Selenium web driver to wait up to N seconds before it gives up searching for an element on a page. By default, implicitly_wait is set to 0, which means that if an element is not immediately available, it will fail immediately if, upon loading the page, it doesn’t find the […]

  • How to find the Parent Element in a page using Python Selenium WebDriver

    How to find the Parent Element in a page using Python Selenium WebDriver

    This is a quick article to show how you can easily get the parent element of an HTML element using Selenium Webdriver with Python. There is more than one way. Let’s suppose that we want to get an HTML button that has no id or unique CSS class from within an HTML page: 1. Getting […]

  • How to crop and resize an image using Tensorflow.js tf.image.cropAndResize

    How to crop and resize an image using Tensorflow.js tf.image.cropAndResize

    This is a quick post to show how you can use tf.image.cropAndResize to crop and resize an image to a square using the function tf.image.cropAndResize. This function was created for a specific purpose to cutout the bounding boxes given by a face detection algorithm. But you can use it for other purposes too! Your image […]

  • Python Exercise for Beginners – Getting a list of IP addresses to Whitelist for Cloudflare

    Python Exercise for Beginners – Getting a list of IP addresses to Whitelist for Cloudflare

     In today’s video we are going to be working on a real-life Python script for Devops. Many websites in the world today are protected against DDoS attacks by Cloudflare.Cloudflare provides this protection by serving as an intermediary to all traffic from the web. So instead of a website visitor connecting to the server hosting the […]

  • Python Exercises For Beginners – #1 – Sum all integers from Zero to N

    Python Exercises For Beginners – #1 – Sum all integers from Zero to N

    Create a Python function that sums all the numbers from 0 to a number N. If a non-positive or a non-integer number is provided, the function should return 0. This Google Colab notebook is part of my “Python Problemns for Beginners” Youtube series: https://youtube.com/playlist?list=PL3OV2Akk7XpC-fsHuJ3RLpnzOXmED7oAI In this video, the first in the series, I show you […]

  • A tutorial on how to convert a Tensorflow model to Tensorflow.js

    A tutorial on how to convert a Tensorflow model to Tensorflow.js

    In this article, I will take you through the steps that are needed to convert any model in Tensorflow Hub to Tensorflow.JS format, and how you can quickly make a simple interactive page that you can host on any web server on the internet. I am only scratching the surface of what is possible. More […]

  • How to Render a Panda Data Frame as HTML

    How to Render a Panda Data Frame as HTML

    Sometimes it might be useful to convert a Panda Dataframe to HTML. For instance, you might want to render a panda data frame inside a web page, outside Jupyter Notebook. You can do this by calling the df.to_html() function. Where df is the Panda data frame that you would like to render. Let’s first create […]