Articles in the Computer category

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 …

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 …

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 …

Document Scaning in Arch Linux

Using a scanner in arch is pretty perplexing at first, especially if you want to try it from the command line. Here are my steps to end up with something that works.

First install the sane package. Sane provides a command line tool for using scanners.

sudo pacman -S sane …

When Memory is not enough

A computer or server suddenly freezes or crashes. You don't know what the problem is and you really need to complete this task. One of the options is to consider memory. You might have just run out. To confirm this, you can monitor memory usage using the htop command while …

« Page 3 / 6 »