Brief Overview of Pelican

Recently I switched this website from Django to a static site. This article gives an overview of the core concepts of Pelican, covering areas that are not directly captured in the official docs. This is written primarily to solidify my own understanding and also act as a reference for myself …

How to Create a Random String

Random strings are used everywhere in computing -- mostly as keys for cryptographic signing sensitive data. So how does one go about creating one? My first thinking was to use Python code and its random library. I came up with this import string import random def gen_random_string(length=32, charset=string …

Adding timedelta to a datetime.time

• 2 min read
python 
One of Python's strengths is its exhaustive library. And date and time management is an integral part of this, provided by the datetime. Logic suggests that timedelta. That is code like this would produce an error: >>> from datetime import datetime, date, time, timedelta >>> dt1 = datetime.now() >>> td1 = timedelta(hours=1 …

Convert time string to datetime.time object

• 2 min read
python 
I'm still finding my way around the rather vast Python standard library. And today, I discovered a quick way to convert a pure time string (of format HH:MM[:SS]) into a standard datetime.time object. datetime.strptime('08:00', '%H:%M').time() That's it! A single, rather short line …