I've written a very small Python 3 script to initialize Blogofile posts;
It generates a post number, prompts for a title, automatically sets the date, and adds an empty categories field.
It uses the basic simple-blog conventions, but the script should be easy enough to change to your setup.
Not very useful (yet?), but it makes starting a post just that tiny bit easier.
#!/usr/bin/python3
#
# Simple helper tool to create blog entries.
#
import datetime
import os
import re
EDITOR='<editor here>' # I use 'geany -l7'
BLOG_ENTRY_PATH='<(sub)directory of _posts here>'
def find_next_number(path):
'''Reads the directory, and returns the first available post number'''
all_post_numbers = []
all_files = os.listdir(path)
p = re.compile('^([0-9]+)\s+')
for filename in all_files:
match = p.match(filename)
if match:
all_post_numbers.append(int(match.group(1)))
all_post_numbers.sort()
return all_post_numbers[-1] + 1;
def prompt_for_title():
return input('Post title: ')
def get_new_date():
now = datetime.datetime.now()
return now.strftime('%Y/%m/%d %H:%M:%S')
class Post:
def __init__(self, path, number, title, date_str):
self.path = path
self.number = number
self.title = title
self.date_str = date_str
def get_filename(self):
filename = '%03d - %s.markdown' % (self.number, self.title)
return os.path.join(self.path, filename)
def create_file(self):
with open(self.get_filename(), 'w') as out_f:
out_f.write('---\n')
out_f.write('title: ' + self.title + '\n')
out_f.write('date: ' + self.date_str + '\n')
out_f.write('categories: \n')
out_f.write('---\n')
out_f.write('\n')
number = find_next_number(BLOG_ENTRY_PATH)
title = prompt_for_title()
date = get_new_date()
post = Post(BLOG_ENTRY_PATH, number, title, date)
print(post.get_filename())
post.create_file()
os.system('%s "%s"&' % (EDITOR, post.get_filename()))
Today, the page with DNS RR types got a little bit of attention, and made a short round on twitter. Which of course reminded me that I had not updated it for quite some time now.
There were some nice ideas from @digdns and @Habbie, most importantly a way to automatically match it to the official IANA page, and a more parseable page (in, for instance, xml) for others to use (Thanks btw :)).
I had originally just made the list directly in HTML, which is of course no way to go, and I'm almost ashamed to admit it.
But now I have written a nice little script that reads a csv file and generates the page. It also matches entries on the official IANA registry to see if it is missing any. It does not (yet?) see if the data is correct, since I'm storing different data in my list.
This script also has the potential to output something parseable, but I have not gotten to that yet, I first want to do the checking better.
Anyway, I did update the list, fixed a few entries, and added missing ones.
Happy, er, rrtyping!
clcms has served me well for the past 6 years, but it is time to move on. I wanted to do some things that it didn't really support, to make my site more, well, 'bloggy', and had almost started an entire new project for it, but I figured there are just too many static site generators available.
So I scoured the wastelands of the Internet, and after a long and arduous journey, found Blogofile.
Or well, it was one of the 3 frameworks I considered, and this one had a quote from Spaceballs in its documentation. Score. It also happened to look and behave almost exactly like what I had in mind for clcms-v2.
Over the weekend I've been moving my site over, and I got to the point where I'm comfortable enough with it to make the switch. I did make some custom templates and hacked the blog controller in a few ways. I may even post about them shortly, now that I have an Official Blog (tm).
So as of now, this site is proudly powered by Blogofile! (applause, beer all around). You can enjoy the biggest new feature, an RSS feed, right away (see the bottom of the page).
During the move, I did remove some legacy pages (like clcms, which is now officially retired), and updated the looks a trivial amount, but nothing too big yet. If you want to see the difference, if you are missing something, or if something that used to work does no longer, I kept the old site around for now at http://old.tjeb.nl.
But if there's anything wrong with the site, please let me know :)
I'm not entirely done yet; I want to create some filters for easier linking within posts and pages, and I need to go through all my old entries and add categories. And maybe, if I can stomach the CSS, I'll even update the looks a bit more. And then there's a lot of things I want to add, but we'll get to that when we get to that.
For now I'm just gonna enjoy having a new framework to manage my site.
Happy browsing!
new domain
April 17, 2007 at 08:35 PM | categories: site
I got me a new domain: tjeb.nl
I have moved from my old domain, and it should be unreachable now.
The site is completely the same, please use tjeb.nl from now on.
Next Page ยป