Monthly Archives: October 2008

Fix Moveable Type Export with Metatag TAGS instead of KEYWORDS

Sometimes a Moveable Type export puts the tags in a Metatag field called TAGS. Sadly this kind of export file does not preserve the keywords/tags when it is imported in WordPress. Here is a little fix to get these TAGS converted to KEYWORDS.
cat original.txt | sed ‘/^TAGS/s/ /,/ig’ | sed ‘/^TAGS/s/"//ig’ > converted1.txt ;let lines=`cat [...]

Simple way to get a diff to a server without subversion

I recently ran into the problem that I had to update the changes I made on my subversion sandbox to a shared hosting account.
In general you would just check out the revision you need or run a svn diff.
Sadly this is not only possible and you need to figure out the changed files which you [...]

Getting a sandbox theme running on wordpress.com

At wordpress.com you can get a great blogging platform with very reliable and fast hosting for free. It comes with some restrictions compared to the self hosted wordpress.org version. One of them is that you can not upload your own themes.
Luckily there is the custom css upgrade which allows an easy alteration of the stylesheet [...]

Split up urls in their components

This little call finds urls in a string and splits them up in their components. All with labels for easy usage.

preg_match_all(‘/(?P<protocol>(?:(?:f|ht)tp|https):\/\/)?(?P<domain>(?:(?!-)(?P<sld>[a-zA-Z\d\-]+)(?<!-)[\.]){1,2}(?P<tld>(?:[a-zA-Z]{2,}\.?){1,}){1,}|(?P<ip>(?:(?(?<!\/)\.)(?:25[0-5]|2[0-4]\d|[01]?\d?\d)){4}))(?::(?P<port>\d{2,5}))?(?:\/(?P<script>[~a-zA-Z\/.0-9-_]*)?(?:\?(?P<parameters>[=a-zA-Z+%&\&amp;\'\(\)0-9,.\/_ -]*))?)?(?:\#(?P<anchor>[=a-zA-Z+%&0-9._]*))?/x’,$text,$data)

lighttpd for image hosting

In order to take some work of the webserver I recently installed a lighttpd server for delivery of static files.
The following tuning did the job (thanks to the video sharing script)
/etc/lighttpd/lighttpd.conf

server.max-keep-alive-requests = 4
server.max-keep-alive-idle = 4
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
server.max-fds = 8192
server.stat-cache-engine = "fam"

/etc/sysctl.conf

# These ensure that TIME_WAIT ports either get reused or closed fast.
net.ipv4.tcp_fin_timeout = [...]

Hello world!

This is the place where I put random snippets I find around the web. Some might be useful, some not, but at least they are all at one place where I can find them.