Randomize GNOME3 Wallpaper
I've been looking for a simple script to randomize the display of my wallpaper on my GNOME3 desktop. After trying a few apps and not finding anything satisfying, I made my own. It's based on Dhananjay Sathe's wp-show but stripped of the GTK options dialog and some senseless redundancy.
Here it is:
#!/bin/bash # To change wallpaper automatically after N minutes, add this to your CRON (where N is minutes): N 0 * * * /path/to/wp-show base="/home/pluc/.walls/" photo=$(find $base -regex ".*\([jJ][pP][gG]\|[jJ][pP][eE][gG]\|[gG][iI][fF]\|[pP][nN][gG]\|[bB][mM][pP]\)$" -type f | while read x; do echo "`expr $RANDOM % 1000`:$x"; done | sort -n | sed 's/[0-9]*://' | head -1) uri="file://"$photo gsettings set org.gnome.desktop.background picture-uri "$uri"
OAuth, Timestamps and VPSes
During yesterday's #HackEmail, I was hacking away on a little Context.IO/Dropbox application to allow users to send files to their Dropbox by email. I only had a few hours to come up with a working prototype to have a shot at taking first place and the glorious iPad that came with it... however, I ran into a problem.
See, the OAuth protocol uses timestamps and nonces to validate requests. Should the timestamp of the requestee be negative or inferior to the timestamp of the requested, the request will fail and the whole OAuth workflow will fail, and chances are you'll have no goddamn clue why. Fear not! I experienced it, so I had to understand it.
Installing mod_pagespeed on CentOS (cPanel/WHM)
This month, Google announced the release of an Apache module to optimize rendering times called mod_pagespeed. They've long been on to the optimization wagon: last year, they released "Page Speed", a Firefox extension to help developers optimize their pages and embed most of mod_pagespeed's diagnostics in their Webmaster Tools platform. If you want to install mod_pagespeed on your CentOS server running cPanel and WHM, you might have a few problems since the mod_pagespeed RPM depends on the httpd 2.2 package and it usually isn't installed when running cPanel/WHM since those app want to be able to control versioning themselves and not through YUM, so we'll do it manually. This guide is intended for 32bit CentOS servers where you have superuser privileges on and run cPanel and WHM. If you're running a 64bit, simply adapt the various paths and files used throughout this article.
What you need to do is rather simple and safe. It does involve modifying the Apache configuration files though, so make backups of every file mentioned in this article if you feel the need to.
Converting ext3 partitions to ext4 on Ubuntu 9.04 (Jaunty)
I've upgraded to Ubuntu 9.04 ("Jaunty Jackalope") from 8.10 ("Intrepid Ibex") about a week ago and was surprised how smooth it went. Jaunty's still in its alpha stage (Alpha 3 as of now) yet it's surprisingly stable. One thing that Jaunty, once officially released, will add to the regular Ubuntu is ext4 support. Ext4 is an upgrade from (wait for it.... you'll never guess!) ext3, which is starting to show its age in the filesystem world. Ext4 provides better performance than ext3, mostly due to its delayed allocation and more file support (like you'll ever have files bigger than 2 or 16 Terabytes?). Anyway, I felt like risking an in-place conversion of my two ext3 partitions for the sake of performance... and it went relatively smooth. I'll explain how I've done it so you can give it a whirl as well. One thing worth noting though is that once a filesystem is converted to ext4, there's no going back. You can't convert it in-place to ext3, you must format the whole thing and start over. So obviously, back your shit up.
