Tags

static website generation with jekyll

10:18, July 2, 2018

So in an earlier post I mentioned I’d be rebuilding all of my dynamically generated website stuff with a static generator. Still doing that, but now I’m using Jekyll.

Mostly, I decided I just wouldn’t re-invent the wheel.

Some tricks

The posts tree

That tree on the left there - that’s generated with a method similar to in this blog post, and uses jquery.treeview at the moment (must get around to updating that).

The tags list

Also on the left, the tags list is auto-generated. Individual tag pages are automatically generated using jekyll-tagging.

Instagram collection

On the right, we’ve got posts pulled from my Instagram account, using their soon-to-be-deprecated Instagram API. I have a script which basically generates a Jekyll Collection from the available posts, and then I render that with a simple bit of Liquid.

Probably I’m going to have to do some really annoying data scraping if I want to keep having this work in the future.

Concerns

Plugins are done in Ruby. I don’t like Ruby.

Also, a lot of the URLs have changed, but I’m not sure just how much I care about that. I mean, who would be linking to this site?

rebuilding things

23:05, January 30, 2018

Recently I decided it’s about time to retire the ancient server that has been running my website (and mail and dns and a bunch of other things) - It’s a Northwood Pentium 4 Xeon from 2002, the kind with Hyperthreading. Running Linux 3.7.10. 32-bit.

Yes, that’s old.

Rather than upgrade, I’m probably moving all of this somewhere else, likely a cheap VPS somewhere… and since there’s a whole bunch of really old Perl running things here… I’ve been doing some rewriting.

Static webpage generation

The original website I put on this current server used a backend based on some unspeakable perl, but the most recent was using Pylons… and by “recent” I mean circa 2010. So yeah, that’s got to be redone. I pondered another web application, but decided that rather than doing on-the-fly content generation from templates, why not just pre-generate it?

So that’s what I’m doing. I’ve started building a bunch of Python scripts using, Jinja templates, and Markdown for blog content. Naturally, all run by Makefiles.

Let’s Encrypt

Since I’m doing it all new, I’m finally going to go full SSL, via Let’s Encrypt. Yeah, about time.

So yeah. Stay tuned.

a JSON REST trick

12:45, December 21, 2012

So I’m doing some REST stuff with SQLAlchemy classes, and I needed a simple way to dump the objects to JSON. This base class will convert an object to a dict, and has some options for funny fields and such.

You may (will) want to use a custom JSON encoder (see simplejson docs) to convert some of the data types, like datetime.datetime in particular.

It’s certainly not ideal, in particular the isinstance() call, but it works at the moment for what I’m doing.

class JsonObject(object):

    def __to_json__(self, exclude_fields = []):
        d = {}

        for prop in dir(self):
            if prop.startswith('_') or prop in exclude_fields:
                continue
            val = getattr(self, prop)

            # we want standard data, not instance methods and such
            if callable(val):
                continue
            if isinstance(val, (sqlalchemy.schema.MetaData, JsonObject)):
                continue

            # you can define a custom formatter for this data
            if hasattr(self, '__formatters__') and prop in self.__formatters__:
                d[prop] = self.__formatters__[prop](data)
            else:
                d[prop] = val
      
        return d

Fixing stuff again

23:50, December 1, 2011

I’ve been messing with building REST APIs in Pyramid, and one thing that lacking was the ability to send HTTP error messages to the client as JSON objects. Pyramid only had support for HTML or plain text, neither of which is easy to parse when you’re writing a JavaScript client.

So…. this commit to the Pyramid project ought to take care of things nicely.

Hopefully they’ll accept my pull request. If not, I can always just maintain my own fork.

New blog engine

01:04, October 21, 2010

So I’m testing out a new blogging enigne I’ve written in Python.

It’s based on Pylons and MongoDB, with a few nice extras, Genshi, WTForms, jQuery, Markdown, the usual stuff. I did this mostly as a playground for using these new technologies in various work and not-work projects.

[RSS]