Posted by Alpha
Thu, 02 Oct 2008 14:25:25 GMT
Now that I got a Lenovo X200, decided to use Mozilla Weave to sync Firefox 3 across all my computers. In short, this involves getting WebDAV and mod_auth working on lighttpd.
Enabling WebDAV and mod_auth on Ubuntu
$ lighty-enable-mod
$ sudo apt-get install lighttpd-mod-webdav
lighttpd.conf
server.modules = (
...
"mod_webdav",
...
)
$HTTP["host"] =~ "weave.foo.com" {
server.document-root = "/foo/weave"
accesslog.filename = "/var/log/lighttpd/weave/access.log"
webdav.activate = "enable"
webdav.is-readonly = "disable"
webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/foo/weave/passwd.dav"
auth.require = ( "" => ( "method" => "basic",
"realm" => "webdav",
"require" => "valid-user" ) )
}
Generating the htpasswd file and fixing permissions
$ sudo apt-get install apache2-utils
$ sudo chown www-data:www-data /foo/weave
$ sudo -u www-data htpasswd -c /foo/weave/passwd.dav [username]
$ sudo -u www-data chmod 600 passwd.dav
Lastly, the latest Weave bits can be downloaded here: http://people.mozilla.com/~cbeard/weave/dist/latest-weave.xpi. It takes a couple tries to get it working, but you’ll need to fix the server in preferences and then sign in using the created user:pass in the passwd.dav file.
Posted in default, server, ubuntu | no comments | no trackbacks
Posted by Alpha
Tue, 15 Jul 2008 06:08:26 GMT
Got bored over the weekend, and decided to make my life easier by writing a Flickr Set to Facebook Album converter. For a GUI, I used Camping, as it doesn’t need to be particularly complicated. I wrote Flickr and Facebook interfaces from scratch, mostly because I needed a fairly limited subset of the functionality their APIs provide.
I’m not releasing the URL since it’s hosted on my home server and I don’t really have the bandwidth, but if you want to play with it, ping me and I’ll let you know. (You can probably guess what it is if you’re familiar with my other projects.)
Anyhow, the code’s available on github for anyone who wants to use it themselves. Note that you’ll need Flickr and Facebook API keys.
There’s nothing particularly interesting about the code, but it was fun to implement the APIs from scratch. It was surprisingly easy, taking a few hours of work and coming in just over 200 LOC.
Posted in ruby, programming | no comments | no trackbacks
Posted by Alpha
Wed, 06 Feb 2008 10:00:30 GMT
This is something that should be widely known by now, but is strangely not.
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores true
This will come in useful later on when I post on how to use NFS and SMB to share files between Ubuntu and OS X.
Posted in default, tips, osx | 2 comments | no trackbacks
Posted by Alpha
Mon, 04 Feb 2008 09:36:00 GMT
Hitting Return activates the button with the solid highlight while hitting Space activates the one with the glow highlight. Very handy when there are multiple options in a form that are used often.
Posted in default | no comments | no trackbacks
Posted by Alpha
Mon, 28 Jan 2008 00:02:59 GMT
With much thanks to this blog post, which reveals how to fix /etc/ushare.conf and /etc/init.d/ushare.
Install the dependencies:
$ sudo apt-get install libupnp-dev pkg-config
$ sudo echo "deb http://www.geexbox.org/debian/ unstable main" >> /etc/apt/sources.list
$ sudo apt-get install libdlna-dev ushare
(uShare’s being installed here just to grab the conf files.)
Pick up the latest version of uShare (assuming Mercurial is installed):
$ hg clone http://hg.geexbox.org/ushare
In the uShare directory:
$ ./configure --prefix=/usr/local
$ make
$ make install
Now the configuration files need to be edited. Make the appropriate changes to /etc/ushare.conf, making sure to modify ENABLE_XBOX to USHARE_ENABLE_XBOX. The rest should be self-explanatory.
In /etc/init.d/ushare, add USHARE_OPTIONS="-f $CONFIGFILE" so that the correct command line is sent to uShare.
And now you should be able to stream videos from your Ubuntu fileserver to your Xbox 360.
Posted in default, server, ubuntu | 1 comment | no trackbacks
Posted by Alpha
Fri, 25 Jan 2008 08:51:58 GMT
I forgot where I saw this originally, but it’s a handy way to generate random passwords:
$ openssl rand -base64 6
Posted in default, tips, server | no comments | no trackbacks
Posted by Alpha
Thu, 03 Jan 2008 10:36:00 GMT
The previous method was a bit messy, so I’ve cleaned it up a bit.


Download twitter_stats.tar.gz
Read more...
Posted in default, ruby, programming | 3 comments | no trackbacks
Posted by Alpha
Wed, 02 Jan 2008 20:40:00 GMT
I saw Damon Cortesi’s Twitter Stats script last night, and decided to make a Ruby version. This was before he released his code, so it’s reverse-engineered rather than ported. I’ll take a look later tonight to see how much the logic differs.
Edit: This code is rather inelegant, and I’ve replaced the clunky CSV files with an Sqlite3 database. You can find the new and improved scripts here. The following should still work, and I’m leaving it here for posterity’s sake.
Read more...
Posted in default, ruby, programming | 3 comments | no trackbacks
Posted by Alpha
Sun, 30 Dec 2007 23:38:00 GMT
anim = Magick::ImageList.new(*Dir["/some/path/*.jpg"])
anim.each {|img| img.resize!(200,200) }
anim.delay = 10
anim.unshift Magick::Image.read("/some/image.jpg")[0].resize(200,200)
anim << Magick::Image.read("/some/other/image.jpg")[0].resize(200,200)
anim.write("animated.gif")
Example image:

Posted in default, ruby | no comments | no trackbacks
Posted by Alpha
Sun, 30 Dec 2007 21:05:58 GMT
It took me no small amount of time to figure out how to horizontally and vertically center image links, so here it is for posterity’s sake. Note that this doesn’t work in IE and is rather specific to my purposes in creating thumbnail links for a bunch of pictures.
HTML:
<div class="thumbnail">
<a href=/some/link>
<img src=/some/image>
</a>
</div>
CSS:
.thumbnail {
height:150px;
width:150px;
line-height:150px;
text-align:center;
}
.thumbnail img {
vertical-align:middle;
}
Posted in default, tips | no comments | no trackbacks