2021-08-01: Sorting algorithm: Partitioning Before: After: The algorithm Select a random pivot (ours is the number 3) Pick the left pointer …

2021-07-26: Algorithm: First index of 'x' Here, the index of x given the string abcxcxyz is 2. Python #recursion def index_of(str, idx=0) …

2021-07-26: Algorithm: Triangular Numbers Python #recursion def triangular_number(n): if n == 1: return 1 return n + triangular_number(n-1) …

2021-07-25: Algorithm: Return even numbers from array of numbers Python #recursion def even_num(n: list) -> list: curr = [n[0]] succ = n[1:] is_even = (curr[0] % …

2021-07-25: Algorithm: Count number of characters in array of string Python #recursion def num_of_strs(arr) -> int: """Accepts an array of strings and …

2021-07-23: Algorithm: Count how many 'z' is in a string Python #recursion def count_z(txt): if len(txt) == 0: return 0 remaining_chars = count_z(txt[1:]) …

2021-07-23: Algorithm: Reverse a string Python #recursive def reverse_str(txt): if len(txt) == 1: return txt[0] return reverse_str(txt[1:]) …

2021-07-22: Algorithm: Sum all the elements of an array Python #recursion def total_sum(arr: list) -> int: if len(arr) == 1: return arr[0] return arr[0] …

2021-07-20: Algorithm: Flatten a multidimensional array Python Using recursion: def flatten(nested_array): for e in nested_array: if type(e) == list: …

2021-07-19: Data Structure: Queue Python class Queue: def __init__(self): self.data = [] def enqueue(self, element): …

2021-07-19: Data Structure: Stack Python class Stack: def __init__(self): self.data = [] def push(self, element): …

2021-07-18: Algorithm: Find the first non-duplicate character in a string Python O(n): def non_dupe_char(some_word): table = dict() for c in some_word: table[c] = …

2021-07-18: Algorithm: Find the missing alphabet from a string Python Solution 1 (O(n)): def missing_alphabet(line): alphabet = 'abcdefghijklmnopqrstuvwxyz' for c …

2021-07-18: Algorithm: Return the first duplicate value in an array Python O(n): def duplicate_value(str_arr): """A duplicate must appear in …

2021-07-18: Algorithm: Is array1 a subset of array2 Python O(n): def is_subset(arr1, arr2) -> bool: """Where arr1 <= …

2021-07-17: Algorithm: Finding the intersection between two arrays Python arr1, arr2 = [1, 3, 2, 7, 4], [12, 1, 3, 6, 8, 7, 4] Solution 1 (O(n*m)): inxsn = [] for i …

2021-07-15: Algorithm: Bubble Sort Python O(n²): def bubble_sort(array): length = len(array) - 1 for _ in range(0, length): for i in …

2021-07-14: Algorithm: Insertion Sort Python O(n²): def insertion_sort(array): for rightside in range(len(array) - 1): rightside += 1 …

2021-07-05: Algorithm: Even numbers from 1 to m Javascript function even_nums_to(n) { let ctr = 0; while (ctr < n) { ctr += 2; console.log(ctr); …

2021-07-05: Algorithm: Fibonacci Series Python O(2^n) def fibb(n): if n == 1 or n == 0: return n else: addend1 = n - 1 addend2 = n - 2 …

2021-07-04: Creating a web app in Rust Create the project using cargo List all the dependencies in Cargo.toml Set up the web app in …

2021-06-30: Use "flake8" line length on "black" Context Developing in Python with VS Code using flake8 for linting and black for auto-formatting. …

2021-06-28: Autoselect the first item from the drop down menu Context Vim autocomplete using coc.nvim plugin. Get a behavior similar to VS Code where the first …

2021-06-18: Creating a web app in Django Prerequisites: You’ve installed Django. If not, \$ pip install django. You’ve created …

2021-06-11: List element comparison exercises Given an instance of a class and an instance of an object, how do they differ from each other. So …

2021-06-10: Python Descriptors Looking up an attribute of Describe instance 1 from a Client instance or a Client class requires …

2021-06-07: Regular Expressions Range Meta-characters Anchors Quantifiers Character match Matches the exact characters in the …

2021-06-06: An Automator workflow for generating random integers with Python 2.7 This workflow generates 10 …

2021-06-06: Table of mutable, hashable, and iterable objects in Python Sets can only have hashable objects as values Dicts can only have hashable object as keys

2021-06-06: Does the object contain this Given that the soup is a container: if fly in soup: tell_the_waiter() We search the soup for any …

2021-06-05: Creating our own subscriptable object In my previous post, the Basket object can be iterated (for example, over a for loop). But it cannot …

2021-06-04: Impementing our own iterable object You only need to implement the following methods: __iter__() __next__() Example for b in …

2021-06-03: Demystifying Python context managers with open(secret_file) as eyes_only: read_discreetly(eyes_only) The point behind this is that if …

2021-05-28: The Pythonic way of reading lines of text in a file div.featured-img { visibility: hidden; position: absolute; } The above contents as processed by …

2021-05-28: Python `for` loop behind the scenes div.featured-img { visibility: hidden; position: absolute; } Here we have a string iterated by a …

2021-05-26: When your GitHub credentials in Homebrew becomes invalid Clear the stale credential from the MacOS keychain: Generate a new personal access token in your …

2021-05-19: Fun with Arduino: Controlling a servo with potentiometer #electronics, #sensors, #actuators, #IoT

2021-05-18: Fun with Electronics: Using a transistor to drive a relay #electronics

2021-05-18: Creating a basic Django app with Github integration and deployed to Heroku #commandline, #vscode, #backend, #showdonttell

2021-05-18: Fun with Arduino: Controlling servo with flex sensor #electronics, #sensors, #actuators, #microcontrollers, #arduino

2021-05-17: Fun with Arduino: Controlling speed and spin direction of DC motor #electronics, #potentiometer, #pushbutton, #switch, #dc motor, #h-bridge, #transistor, #ic

2021-05-17: Fun with Arduino: 'softpot' variable resistor #electronics, #arduino, #IoT, #microcontrollers, #embeddedsystems

2021-05-16: Neural Network Backpropagation Forward pass The forward pass, leading up to the ReLU activation function can be summed up by this, …

2021-05-12: Rust: Unpacking functions

2021-05-10: Partial Derivatives The partial derivative of the sum with respect to x or y equals 1 (i.e. if you only see addition, …

2021-05-10: Rust: Ownership SomeObject (represented by the blue ball) resides in a memory in some location (0xabc123beef is the …

2021-05-07: Derivatives Writing derivatives using the Leibniz notation All of these are the different ways to write the …

2021-05-05: Softmax activation function and exponential function Softmax function: An activation function for classification Exponential function value is always …

2021-05-03: Activating ReLU function in the hidden layers Our neural network, which is not densely connected, has 2 hidden layers with 8 neurons each. …

2021-04-30: ReLU activation on a two-neuron network Starting with a weight = 0 and bias = 0 on a single neuron: Setting weight = 1.0 while keeping bias …

2021-04-30: Forward pass on a dense layer neural network A dense layer is a fully-connected neural network layer.

2021-04-29: Generating a random 2x4 matrix in NumPy The 0.01 value is for making the randomly generated values a …

2021-04-29: Neural network with two hidden layers Hidden layer 1 (with code)

2021-04-29: A neural network with one hidden layer This neural network has 4 features in the input layer and 3 …

2021-04-28: Matrix transposition visualization Given a pair of variables inputs (3x4 matrix) and weights (3x4 matrix). The matrix on the right side …

2021-04-27: Row and column vectors in NumPy

2021-04-27: Matrix transposition visualization Transposition modifies a matrix in such a way that rows become …

2021-04-27: Visualizing matrix multiplication

2020-08-28: Replacing the front caster from a wheel to a ball made from a roll-on deodorant applicator. …

2020-08-27: Update: Light seeking robot project Making the wirings pretty. #arduino, #electronics, #sensors

2020-08-25: Installing headless JupyterLab on a remote Linux server Prerequisite: python3-pip package python3-dev package Installation You only do this per new …

2020-08-25: Using a Python 3 virtual environment for Python projects \$ mkdir proj_foo && cd proj_foo or \$ take proj_foo \$ python3 -m venv env_foo \$ source …

2020-08-25: When ssh connection drops out after a few minutes of inactivity This is the error message it …

2020-08-16: Prototyping the battery holder bracket. #arduino, #electronics, #sensors

2020-08-16: Light following robot project It’s finally done–testing and all. Now, to make it a little less messy. #arduino, …