Articles by John Nduli

Python Generators

Generators are functions that behave like iterators, thus can be used in for loops. For example, a generator that produces even numbers will look like:

def even_numbers(upperlimit):
    current = 0
    while current < upperlimit:
        yield current
        current += 2

Generators are also created using a syntax similar to list comprehension:

even …

Ansible and SSH Port

Hackers and bots try to log into servers all the time. They do this by trying random ssh logins into your server. A deterrent to this is to disable the default ssh port and set it to something else. Also, disable root login as this is the most common user …

Pagination: Review of Django's and Pelican's Implementation

Pagination is the process of dividing up a document into discrete pages (wikipedia). Django and Pelican have similar pagination implementations. This boils down to having a class that has accepts a sliceable object as one of its params, and returns a page containing list of items depending on number of …

Django's Cached Property

I've been trying to understand how django's decorator @cached_property works. Here is the class definition (original source):

# Got from django code base
class cached_property:
    """
    Decorator that converts a method with a single self argument into a
    property cached on the instance.
    Optional ``name`` argument allows you to make …

Courage To Be Disliked: A Review

Courage to be disliked is a book that explains Adlerian psychology. It does so in the form of a dialog, between a student and a master. Here are the various ideas I got from reading the book:

Etiology vs Teleology

Etiology is when someone focuses on the past, and uses …

Sway Window Manager

Wayland is a display server that should work as a replacement for X. I've been thinking of trying it out for some time now. Detailed information about wayland and its history can be found in this article. The differences between xorg and wayland can be found here or in this …

Summary of 2018

This year has been meh for me ;( The highlights for the year include:

  • Completing course work for my masters class
  • Starting research on Renewable Energy Systems and how best to size them and control this system.
  • Active participation in various communities I managed to join especially Urban Perspective and NaiLUG …

Fixing Small Fonts on My Laptop

I have been having this problem with my laptop where the fonts seem too small. To fix this, I first had to check out my laptop's screen configurations:

xrandr

Part of the output of this command is shown below. As can be seen it shows that my laptop screen is …

Bluetooth Speakers Problems

Connecting to Device

To connect to the bluetooth speakers, I use the bluetoothctl commandline options. The following are commands I run for this to work:

sudo systemctl start bluetooth.service
bluetoothctl
# Within the bluetoothctl environment
power on
agent on
default-agent
scan on
pair A4:A7:B5:22:E6:F5
connect …

Freeing up Space in my Linux Machine

I have a 256GB SSD on my laptop. This is rather constrained and I occasionally end up with less than 10GB drive space. When this happens, I have to figure out what is taking up all my space and fix this. This prompts some form of search and cleaning up …

« Page 4 / 8 »