Search this site





Pyblosxom sorted tag cloud patch

wxs has this neat tag cloud thing on his site. I like it so much, I wanted it here on this site, so I installed plugin last night and put it in place of the 'categories' section of the sidebar.

However, the default tag cloud isn't sorted, so finding things in it is, well, hard.

Here is a patch that will sort your tag cloud alphabetically.

Antispam pyblosxom plugin, followup!

REJECT: Comment attempt by rejected. Reason: Invalid secret token: 'pleaseDontSpam'
REJECT: Comment attempt by rejected. Reason: Invalid secret token: 'pleaseDontSpam'
REJECT: Comment attempt by rejected. Reason: Invalid secret token: 'pleaseDontSpam'
REJECT: Comment attempt by rejected. Reason: Invalid secret token: 'pleaseDontSpam'
REJECT: Comment attempt by rejected. Reason: Invalid secret token: 'pleaseDontSpam'
The list goes on. Well over 50 invalid tokens were found. The 'pleaseDontSpam' was the original secret token I used. Just goes to show that, for the moment, most spam bots don't review the page before submitting.

Admittedly, 2 spams got through, I have not investigated why, yet.

Pyblosxom comment antispam plugin

Ever since I added comments to this site, I've started getting comment spam. To combat this, I hacked together a comment management system using jquery and python. It lets me search comments and delete them via web interface.

I'm bored of deleting comments by hand. So, I wrote a little antispam plugin. This plugin creates a token that expires after a given period of time. This token is used as a hidden item in the comment form. If this token is expired when the form is submitted, the comment is rejected.

Spam seems to come entirely from solo-connection POST requests. This means that the bots don't bother viewing the page first. In theory, the bots will be using a cached idea of the form, which will be expired. We'll see how well this works.

Right now it just uses a timestamp. If that fails, I'll add other tokens such as source IP, etc. Perhaps cookies too? This should be simple to filter out, becuase the spam bots don't act anything like humans with regards to browsing behavior.

I have enabled the plugin on this site. I'll post the source when I see it actually working correctly.

Waiting for spam bots to come by is boring :(

Pyblosxom single-entry page title plugin

The page titles pyblosxom provides are usually great. However, when there is only one entry displayed, I feel it would be better to rely on that entry's title.

I wrote a very short plugin to do just that. Turns out the plugin api for pyblosxom is quite easy to understand, and this hack was only about 10 lines. adds a new variable which will contain the standard page title, unless there is only one entry in view. If there is only one entry in view, the page title is augmented with the story title aswell. This makes search engine results and browsers happier, as they can recognize what your page is about by the title. User experience good, also good for search engines.

The new variable you want to use is: $blog_title_or_entry_title

If you want to get a better idea of what this plugin does, you can click the permalink below to view only this entry. The page title (in the url bar) should now reflect this entry's title.


Pyblosxom contributed plugins for 1.3.x finally out

Subject says it all. I've really wanted comments working in pyblosxom 1.3 for quite some time. However, all googling points to old versions of the comments plugin that only works on the older versions. I checked the pyblosxom page tonight and was pleasantly surprised that a contributed plugin set had been released early this month.

If you use pyblosxom 1.3.x, plugin updates are ready for your use.

On that note, comment functionality is FINALLY here on this site. To those of you reading this site, feel free to comment! I love feedback.

Go to the pyblosxom website

All known-broken entries now fixed

Thanks to my handy vim-pybloxsom hack, I took time today to go back through all entries I had marked broken during the move from my old site to here.

Those entries should now be good now with fixed links, etc. Ahh, sweet productivity.

Vim hack for Pyblosxom entry backdating

Hurray! I finally got around to hacking a little script for vim that will automatically track posting dates for pyblosxom entries. It does the following:
  1. For new entries, add '#mdate {currentdate}' on the 2nd line.
  2. For existing entries without '#mdate' metadata, it will look up the mdate of the current entry and append it in the form, '#mdate {mdate of file}'
  3. After you write (:w, :wq, etc), vim will look for #mdate metadata and turn the date into something touch(1) can use, then set the modification date of the file.
This seems to work pretty well, and is quite transparent to pyblosxom, since it sees lines beginning with #foo as "metadata" - so far so good. However, it does jump to the 2nd line of the file when you save, which is annoying (but fixable). I'll fix that later.

My "vim scripting"-fu is not strong, so there's probably a cleaner/fancier way to do this. Anyhoo, you'll need the following in your .vimrc:

" PyBlosxom stuff
augroup pyblosxom
	autocmd BufReadPost /home/jls/public_html/entries/*/*.txt call Pyblosxom_checkdate()
	autocmd BufNewFile /home/jls/public_html/entries/*/*.txt call Pyblosxom_putdate()
	autocmd BufWritePost /home/jls/public_html/entries/*/*.txt call Pyblosxom_fudgedate()
augroup end

function Pyblosxom_checkdate() 
	" Look in the file for '#mdate foo' metadata
	normal 1G
	let dateline = search("^#mdate")

	" If not found, append the mdate of the file to line 2
	if dateline < 1
		let dateline = 1
		let date = system("stat -f '#mdate %Sm' " . expand("%"))

		" Add the date to the file on line 1

function Pyblosxom_putdate()
	let date=strftime("#mdate %b %e %H:%M:%S %Y")
	goto 1

function Pyblosxom_fudgedate() 
	let l=search("^#mdate")
	let l=strpart(getline(l), 7)
	let cmd="date -j -f '%b %e %H:%M:%S %Y' '" . l . "' +%y%m%d%H%M"
	let touchtime=system(cmd)
	let touchcmd="touch -t '" . strpart(touchtime,0,strlen(touchtime)-1) . "' '" . expand("%") . "'"
	call system(touchcmd)

Site move almost done

Spent a bit playing with pyblosxom and such. It's crazy easy to setup. It meets my requirements in that it lets me post things, has useful plugins I want to use, and doesn't require a massive database system.

There's still lots to do:

  • Write a new script to let me post things with my own metadata
  • Integrate CVS/SVN repo information?
  • Add projects and articles sections
  • integrate project and article pages somehow into the blog.