Skip to main content

Posts

Showing posts from July, 2019

Making a weather status screen in Python

As part of my Raspberry Pi powered status script I show the current weather for my city of Montreal. At first I used the widget provided by Weather Canada, but I decided to move to a custom web page by using a simple Python script that reads the RSS feed from the same Weather Canada service, and then show the result using Font Awesome icons and the Bootstrap framework.This is what the result looks like:The first thing to do is import the needed libraries, including feedparser which allows us to parse the RSS feed, then connect to the feed and extract the information. Finally, we display a bootstrap table with the data for the few next upcoming days.This is the complete code:#!/usr/bin/env python3 import os import sys import time import connix import feedparser import re # This is the feed URL rss = feedparser.parse("https://weather.gc.ca/rss/city/qc-147_e.xml") print(connix.header()) print("<html><head><link href='https://maxcdn.bootstrapc…

Setting up a ZFS filesystem on Linux

When installing a new Linux system, typically your default filesystem will be EXT4 or perhaps even XFS, which is the newer filesystem that most recent distributions are starting to use. But when you want to store a large amount of data, you may want to use something more robust. The ZFS filesystem is becoming all the rage, and for good reason. First invented by Sun Microsystems, ZFS provides a lot of cool features:Data integrity: ZFS will silently use checksum values to make sure there is no degradation of data over time, whether from phantom writes, spikes in the hardware current, or silent data corruption.Built-in raid: ZFS provides several raid types without the need of a hardware raid card.Large capacity: With ZFS pools, you can extend multiple hard drives into a single logical volume.Efficiency: ZFS allows you to use cache and log disks to speed up read or write access.Installing ZFSThe first thing to do in order to use ZFS is to install the kernel driver. You can find ou…