Blog

Update: See also http://kuttler.eu/code/wordpress-emergency-admin/ which is a little easier to use. Recently I had to update a site but didn't have an admin account or access to the SQL database. So I wrote this short script to reset a forgotten password. To use it, edit it and fill in the … more

Looking at the code I'm really not sure how it could have taken me more than one minute to figure this out.. but here's an example how to query for documents with a timestamp in the past. Your model's schema obviously needs a timestamp field of the Date type, and … more

Mongoose is quite easy to use, but modifying or annotating a query result manually is a little tricky. The problem is that the result objects are mongoose documents that can't be modified at will. In my case I was trying to change a Date type field to a human readable … more

Are you getting "You do not have sufficient permissions to access this page." errors everywhere in the WordPress admin? I had this happening on a site, apparently the problem is that somebody changed the database prefix. It's a little suprising that this would totally break the admin, but whatever... As … more

I thought there was a simpler method of adding context through the urlconf but after having a look at the source this is what I came up with. Apparently there's only getcontextdata() so I used a lambda to add what I needed. Update: I should probably have used extra_context={'model': 'Frontpage'} more

So I had this project with a peculiar requirement: It had to do a redirect to an existing object when the CreateView failed because such an object already existed in the db. Not really hard to do but it took me a while to figure out.. so here's the code. more

Update: This script is almost obsolete as github will switch to their v3 API on may 1st, 2012 and doesn't display the API token any more... With this this script you can easily migrate a WordPress plugin from the wordpress.org svn repository to github. This script will NOT import the … more

Very annoying typo3 "bug" and it took me long to find a solution. See this Bug report for some more info. more

Hotlinking is always annoying, but easy to prevent. Here are two ways to do this with nginx. The first example simply returns a 405 when any hotlinking is detected. The second example prevents hotlinking only from specific domains. I used this when a site tried to embed media files through … more

Installing Debian GNU/Linux on a Thinkpad X121e

2011-11-13

Installing Debian GNU/Linux on a Thinkpad X121e Installing Debian (testing/wheezy) on the X121e (AMD) was pretty easy, but the documentation I found online was a little contradicting and confusing. I encountered a few problems. Ethernet Update: You can skip this section if you're using a Linux kernel 3.1.0 or newer. The Installation notes on the Debian Wiki … more

DjangoPythonBitcoinTuxDebianHTML5 badgeSaltStackUpset confused bugMoneyHackerUpset confused bugX.OrggitFirefoxWindowMakerBashIs it worth the time?i3 window managerWagtailContainerIrssiNginxSilenceUse a maskWorldInternet securityPianoFontGnuPGThunderbirdJenkinshome-assistant-logo