Archive for the ‘English posts’ Category

Keeping your Varnish farms configuration in sync

I spend some of my free time helping out with server administration and programming for the Swedish Pirate Party, Piratpartiet (look ma, X-Varnish), and we use Varnish for our caches. At the moment it’s just used on some of our projects, but we’re going to migrate most of our projects to be behind our Varnish caches.

The thing is though that we got two hosts running the exact same configuration, and we’d like to keep those hosts in sync. A quick search on Google gave me nothing for syncing varnish configuration over several hosts, or a farm as it were. So I took matters into my own hands and wrote varnishsync, a little bash script that uses rsync and ssh to sync the configuration folder and then to load and use the new configuration.

Please have a look at the Github project for the latest version and usage, and if you’ve any questions or suggestions drop a line here or on Github.

How to: Setting up a Wikileaks mirror

Yesterday I wrote a quick step-by-step guide for installing apache and setting your system up for Wikileaks mass-mirror project in Swedish and I’ve had requests for it to be translated into English.

This guide assumes you’re running Ubuntu or a Debian based system.

I’ve made a script that does all the steps below, feel free to use it!
The script: http://sanitarium.se/files/wikileaks-mirror.sh
Usage: wget http://sanitarium.se/files/wikileaks-mirror.sh && chmod +x wikileaks-mirror.sh && ./wikileaks-mirror.sh

Installing Apache and adding the wikileaks user

# is the prompt as root:

youruser$ sudo -s

Install apache if it’s not installed

# apt-get install apache2

Add a wikileaks user, write down where the home folder is created.

# adduser --disabled-password wikileaks
# su wikileaks
wikileaks$ mkdir ~/.ssh ~/www
wikileaks$ chmod 0700 ~/.ssh
wikileaks$ wget http://213.251.145.96/IMG/id_rsa.pub -O ~/.ssh/authorized_keys
wikileaks$ exit

Time to add the apache site for wikileaks

# cd /etc/apache2/sites-available/
# wget http://sanitarium.se/files/wikileaks

Open the file wikileaks with an editor and change the path to the wikileaks users home folder if it’s not /home/wikileaks.
This file assumes you want to host wikileaks.org, if you want to host wikileaks.yourdomain.com you’ll need to set ServerName accordingly and if necessary ServerAlias, ServerAlias is optional and you can remove that row if you don’t use it.
When that is done you just need to activate the site in apache:

# a2ensite wikileaks

And reload apache so it knows that the new site has been added:

# /etc/init.d/apache2 reload

The wikileaks file downloaded from this server looks like this:

<VirtualHost *:80>
        DocumentRoot /home/wikileaks/www
        ServerName wikileaks.org
        ServerAlias www.wikileaks.org
        ErrorLog /dev/null
        CustomLog /dev/null common

        <Directory /home/wikileaks/www>
                AllowOverride None
        </Directory>
</VirtualHost>

Now tell Wikileaks about your mirror

Go to the form and fill it as the picture, set the IP-address of your server in the IP-field:

If you’re having any troubles don’t hesitate to ask in the comments!

How to: disable Spotify from making P2P connections in Windows XP

I’ve been having trouble at work with the available bandwidth running out when I and my co-workers are using Spotify, a very nice piece of software, but just like Skype it tries to split its content through all available nodes and make sure they share it, which includes its users.

So what I did to force Spotify to only connect and fetch data from the Spotify servers was to use the built-in firewall in Windows XP and specify that spotify.exe is only allowed to connect to: 78.31.8.0/22,193.182.8.0/21, mix up some traffic priority rules at the router for connections to those IP:s and Spotify can still be used, and not taking up all available bandwidth.

Updated 2011-08-23: Added a new IP-range that Spotify uses, 193.182.8.0/21.

How to get your HP un2400 3G modem to work in Ubuntu on a HP 110c-1020SO netbook

I bought a HP netbook this week with the explicit intent to use GNU/Linux on it. I wagered that someone had gotten the built-in 3G modem working and while it was a pain to get installed I was right, someone had made it work!

To help anyone who would be in the same position as I was a couple of days ago I’ve written down the steps I followed to get my modem working on my own wiki and also packed all the files I need to get this working up as a download.

So for the meat of this post please see the HP un2400 3G modem in Linux page on the wiki.

How to reactivate calendar notifications on your HTC Hero if they stop working

A couple of months back, out of the blue, my HTC Hero stopped notifying me on my upcoming calendar events. It didn’t even show upcoming events on the home screen widget, but it kept syncing new events without a problem.

I tried adding and re-adding the calendars I sync on the phone, turning on/off the notifications but nothing worked. I found a link to a guy who had the same problem, which ended up being caused by him force quitting the alarm service. But I had not done that, and either way it should’ve started working after a reboot if that were the case. Another guy managed to get his notifications working after doing a factory defaults reset.

Resetting to factory defaults isn’t my first choice of action, so I searched for, and found, a way to reset the calendar instead. And after doing that a test notification I set to go off a couple of minutes earlier got synced back to the phone and went off!

On your phone:

Settings -> Applications -> Manage applications
Open up Calendar storage and press Clear data.
I also cleared the Calendar app, not sure if it was needed though.

Posting in hope that if anyone else have this problem they won’t have to rummage through the internet as I did.

How to disable bold fonts in xterm

I’ve so far in all my travels never found a terminal I like better than xterm, maybe urxvt, but I’ve had a problem disabling bold fonts for a very long time. Update: Seems this is a known bug for xterm.

There are a lot of X resource configuration options that makes you think you can disable bold fonts, but alas, I’ve had no luck with any of them. But if you set the same font for both normal and bold fonts it’ll work! This little gem of knowledge I found as an off-hand remark on a configuration page by Emil Mikulic, thank you!

I like the normal fixed font, I’ve tried many terminal fonts but I’ve always gotten back to it. So I simply tucked:

xterm*font: fixed
xterm*boldFont: fixed

Into my ~/.Xresources and afterwards ran xrdb -load ~/.Xresources and started up a new xterm loaded with awesomeness!

xterm with bold font and xterm without bold font

The before and after shot.

Webby with pingbacks/trackbacks

I decided I should have a blog to discuss or publish things I find interesting or otherwise on the Internet. Now the thing is that I also like having things fast, meaning that I think it’s nice if things are static. So enter Webby, easy to use, configurable and easily extendable, through Ruby, and add the fact that webby generates static HTML, it can hardly get any better! :)

That is except for the community building part of having a blog, comments and the ability to tell other people automatically that I’ve written about a post of theirs or the reverse — someone else wanting to tell me that they’ve written about one of my posts. So the first part of that puzzle I found was Disqus which is a javascript commenting system that can be used with any javascript enabled browser. So now I have comments, but Disqus also do trackbacks. But Trackbacks are very spam prone and because of that the community came up with Pingbacks instead. Pingback activated sites does some verification on the incoming links and if all of it checks out it then records it. So what I decided to do was to transform incoming pingbacks, through a proxy, to Disqus trackbacks. I think it’s a nice and simple solution. :)

webby-pingback gem

So I created the webby-pingback gem which consists of two parts.

  1. A pingback client/sender. Using a new meta-data tag with your webby posts and a publish hook you can ping all links in your posts
  2. A pingback receiver/server. A CGI-script using Rubys built-in XML-RPC-library tries to act according to the pingback protocol and if all of it checks out OK it then sends a trackback to the Disqus forum of the post.

So this is all pretty new and I’m hoping someone else will find this useful as well. I’ve added installation instructions at the github repository and I hope they are all pretty self explanatory.

If someone have any questions or comments please leave your mark below. :)

I’ve since the original publication tried to clean up the language/wordings to try to make it more coherent :)

Update 2010-02-21: Since the posting of this post I’ve migrated over to WordPress, while I love the idea with Webby I realized I also wanted to easily make a blogpost even if I were not at my own computer.

The Very Last Post!

Welcome to the very last post of this blog, or at least that is if you’re reading it in the reverse chronological order that all posts are listed in. :)

Just a starter post, nothing too see here, move along now!