Vimalkumar Velayudhan

Menu

Linux and FOSS Guides #1

Linux and FOSS Guides
Vimal’s step-by-step guides for using Linux and open source software

You can subscribe to this free newsletter using the form at the bottom of this page or by visiting Substack.

In this issue

Tutorial: Building PDF output in a Python Sphinx project§

If you are using Python Sphinx to write documentation and would like to build PDF output, you will find a step-by-step procedure for doing this on Linux in this tutorial.

I use Linux Mint, but these steps would also work on Ubuntu-based systems.

Read the blog post or watch the YouTube video.

Useful BASH aliases for working with Python projects§

I have added the following aliases in ~/.bash_aliases. This save some typing while working with Python projects.

initenv§

Initialize a virtualenv, activate it, and update python build tools. Useful when starting a new project.

alias initenv='python3 -m venv venv  \
&& source venv/bin/activate \
&& pip install --upgrade pip setuptools wheel'

va and ve§

Shortcuts to activate and deactivate virtualenv’s.

alias va='source venv/bin/activate'
alias ve='deactivate'

pipo§

Prints a list of outdated packages in a virtualenv.

alias pipo='pip list --outdated'

pipu§

Upgrade build tools, when there are newer versions or if there are any issues while building a package.

alias pipu='pip install --upgrade pip setuptools wheel'

Integrating a Substack sign up form in a static website (Pelican)§

If you run a Substack newsletter and use Pelican for your website, you can follow this method to add a sign-up form in your blog posts. Scroll down to the bottom of this page for an example.

Update pelicanconf.py§

First, add a variable in pelicanconf.py and set it to the domain name of your newsletter. I used SUBSTACK_NAME.

My newsletter is at https://wposs.substack.com, so I set SUBSTACK_NAME to wposs.

SUBSTACK_NAME = 'wposs'

Create a template for the sign-up form§

Create a new text file and add the following code:

{% if SUBSTACK_NAME is defined %}
<iframe src="https://{{ SUBSTACK_NAME }}.substack.com/embed"
  width="480" height="320" style="border:1px solid #EEE; background:white;"
  frameborder="0" scrolling="no"></iframe>
{% endif %}

Save the file as newsletter.html in the templates folder of your theme.

Include sign-up form in article template§

Update the article template (article.html) and include the sign-up form template before the closing </article> tag:

<section>
{% include 'newsletter.html' %}
</section>

That’s it. You should now see the sign-up form at the bottom of your blog posts.

App pick: Contrast§

I am working on improving the accessibility of my website. That includes updating the colour scheme currently in use.

During the process, I found an useful app from the GNOME project called Contrast. Simply input the hex code of two colours and it tells you if there is sufficient contrast between them.

Screenshot of GNOME Contrast app

It is available for installation from Flathub.


This newsletter was originally called Linux & FOSS Newsletter.


If you have any questions or comments on this post, please send them by email to vimal (at) disroot (dot) org.

If you would like your comment to remain anonymous, please state that in your email. In any case, your email address will not be published.