[ Content | View menu ]

Archive for 'code'

Padding Numbers in Filenames

April 8, 2008

I sometimes find myself with scads of files in a directory that, due to the vagaries of sort() do not show up in the “right” order. For example, 1.png, 2.png, … 751.png. I was poking around with rename, but I wasn’t finding a good way to do this. Thankfully, a poster on TLUG showed me […]

blog,code - Comments closed

Go to Date WordPress Widget

April 5, 2008

This is the widget code to have a Go to Date widget in WordPress. It requires the correct permalink structure, but it is easy to paste into a text widget and it works nicely. <script type=”text/javascript”> function gotodate() { var baseurl = “http://example.com/index.php/” var y = document.getElementById(“year”).value; var m = document.getElementById(“month”).value; var d = document.getElementById(“day”).value; […]

code - Comments closed

Backdrop in Python

May 16, 2005

#!/usr/bin/python import os, sys, random, imghdr # This is a little program I call via cron to change my desktop every # few minutes. With no arguments it goes to my directory of backdrop # images and picks a valid image at random. If I specify a path and a # file the program will […]

code - Comments closed