Ebuild for libsummer

March 28th, 2009 — 6:48pm

I wrote an ebuild for the broadcatching library libsummer, that recently released version 0.1.0:

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION="A broadcatching library"
SRC_URI="http://flukkost.nu/libsummer/${P}.tar.bz2"
HOMEPAGE="http://wrya.net/services/trac/summer/"
KEYWORDS="~x86 ~amd64"
SLOT="0"
LICENSE="LGPL-2"
IUSE="bittorrent doc python"

DEPEND=">=dev-libs/glib-2.18.4
        >=net-libs/libsoup-2.24.3
        dev-libs/libxml2
        python? ( >=dev-python/pygobject-2.15.4 )
        bittorrent? ( >=net-libs/rb_libtorrent-0.14.1 )
        doc? ( dev-util/gtk-doc )"

RDEPEND="${DEPEND}"

RESTRICT="mirror"

src_compile() {
        econf $(use_enable bittorrent) $(use_enable python) $(use_enable doc gtk-doc) || die "econf failed"
        emake || die "emake failed"
}

src_install() {
        emake install DESTDIR="${D}" || die "Install failed"
        dodoc ChangeLog NEWS README AUTHORS
}


Download available here. To use unpack directly to your portage overlay.

Note: If you want the bittorrent functionaliy you will have to unmask net-libs/rb_libtorrent-0.14.1. It’s hard masked because it breaks a lot of packages relying on 0.13. Libsummer, however, was built on 0.14.

Comment » | Random stuff

Mailman with lighttpd and Postfix on Gentoo

March 27th, 2009 — 1:38am

This post details how to setup mailman using lighttpd and postfix on gentoo.

Before starting I assume that you have:
* Lighttpd setup and working
* Postfix setup to handle mail from one domain
* MX records setup for the subdomain you want to use for lists

First, we need to install mailman, but before we do that we need to make sure it uses the right UID and GID (lighttpd) instead of apache, which is the default. To do this append

MAILMAN_CGIGID="lighttpd"
MAILMAN_CGIUID="lighttpd"


to /etc/make.conf and then proceed to install mailman:

# emerge mailman

Now it’s time to configure lighttpd. This we do by adding the following to /etc/lighttpd/lighttpd.conf:

alias.url += (
          "/services/mailman/mailman-icons" => "/usr/lib64/mailman/icons/",
          "/services/mailman/pipermail" => "/var/lib/mailman/archives/public/",
          "/services/mailman" => "/usr/lib64/mailman/cgi-bin/",
)

$HTTP["url"] =~ "^/services/mailman" {
        cgi.assign = (
                "/admin" => "",
                "/admindb" => "",
                "/confirm" => "",
                "/create" => "",
                "/edithtml" => "",
                "/listinfo" => "",
                "/options" => "",
                "/private" => "",
                "/rmlist" => "",
                "/roster" => "",
                "/subscribe" => "")
        server.indexfiles = ("listinfo", "index.html")
}
$HTTP["url"] =~ "^/services/mailman/pipermail/" {
             dir-listing.activate = "enable"
             dir-listing.hide-dotfiles = "enable"
             server.follow-symlink = "enable"
}


I choose not to serve mailman from a vhost, if you want to do that you’ll need to change the above accordingly. Otherwise you’ll just have to change the url matches and aliases to reflect from where you want to host mailman. You will also need to make sure that the alias and cgi modules are enabled (located at the top of lighttpd.conf).

The next thing to configure is mailman itself. Append the following to /etc/mailman/mm_cfg.py:

MTA = 'Postfix'
DEFAULT_EMAIL_HOST = 'lists.example.tld'
DEFAULT_URL_HOST = 'example.tld'
DEFAULT_URL_PATTERN = 'http://%s/services/mailman/'
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
IMAGE_LOGOS = '/services/mailman/mailman-icons/' 

POSTFIX_STYLE_VIRTUAL_DOMAINS = [DEFAULT_EMAIL_HOST]

PUBLIC_ARCHIVE_URL = 'http://%(hostname)s/services/mailman/pipermail/%(listname)s'


You should set DEFAULT_EMAIL_HOST to the subdomain you want your lists to use, DEFAULT_URL_HOST to the host from which you will serve the mailman web pages, and change DEFAULT_URL_PATTERN, IMAGE_LOGOS, PUBLIC_ARCHIVE_URL so that they are consistent with your settings in lighttpd.conf. The call to add_virtualhost is need when you change either of the _HOST variables like this.

Continuing, there is a few things we need to do as the mailman user. First install the cron jobs:

# su - mailman
mailman $ cd cron
mailman $ crontab crontab.in
mailman $ cd ..


Then set the site password:

mailman $ bin/mmsitepass


The site password works instead of any other password in the mailman installation, and is used to adminstrate it.

Next we create the site-wide mailing list, which is needed for proper operation of mailman:

mailman $ bin/newlist mailman


And logout from the mailman account and continue…

…with configuring postfix. This is as simple as adding the following two lines to /etc/postfix/main.cf:

virtual_alias_domains = lists.example.tld
virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman

Once again replacing lists.example.tld with the subdomain you want your lists to use.

Now we only need to reload postfix, start mailman and add it to the default runlevel:

# /etc/init.d/postfix reload
# /etc/init.d/mailman start
# rc-update add mailman default


Congratulations, you should now have a working mailman install!

Comment » | Computers

Quake Live

February 27th, 2009 — 3:01am

So today I got around to trying out Quake Live, which went into open beta the other day. If you didn’t know already, Quake Live is very similiar to Quake 3, with the exception that it’s played in a browser.

My first impression is that it seems to have quite some potential, however I won’t be playing it in the near future, as there’s too many bugs left to be able to enjoy it properly. For example, I couldn’t even play through the “warmup match”[1] without QL crashing several times (in both Firefox and IE7, which are the only supported browsers at the moment).

So now I’m looking forward to trying it again in a couple of months or so.

  1. You play against a bot to estimate your skill level, so QL can set you up against opponents with a similiar skill level. []

3 comments » | Games

Ebuild for yubikey pam auth

January 13th, 2009 — 10:09pm

(If you don’t know what a yubikey is, have a look here)

So I wrote up ebuilds for yubico-pam and its dependency yubico-c-client. You can get them here.

Just extract the tarball into your portage overlay and emerge pam_yubico. If you don’t have an overlay, then just do this (as root):

mkdir /usr/local/portage/
echo 'PORTDIR_OVERLAY="/usr/local/portage/"' >> /etc/make.conf
tar xvzf pam_yubico-ebuildstar.gz -C /usr/local/portage/
emerge pam_yubico

For myself I configured sshd to be able to login using either my yubikey or a normal password. I will describe how to do that - if you need some other configuration have a look at the PAM module’s site (mentioned above).

  1. You will need to get your yubico client id. The only way I know of to do this is through the YMS.
  2. Configure PAM to make ssh use the newly installed module. This by prepending auth sufficient pam_yubico.so id=16 try_first_pass to /etc/pam.d/sshd. Be sure to change 16 to the ID you aquired in step 1.
  3. Add your yubikey id to the file pam_yubico looks in, namely ~/.yubico/authorized_yubikeys. Create the file with and add the line user:yubikey_id. The yubikey id is the first 12 characters from the OTPs it generates.

And that’s it. You should now be able to log in over SSH using either your regular password or your yubikey.

Comment » | Computers

Compiling SDL_gfx (2.0.17) on Visual Studio 2008 (VS9)

July 12th, 2008 — 1:47am


IMPORTANT: Turns out I was wrong about why SDL_gfx doesn’t compile - thanks to sweetlilmre for pointing it out.

I strongly suggest using his suggestions for steps 2 and 8, whereas step 4 merely is a matter of preference. You should probably skip step 10 as well, since static_cast() is not C, but C++.

Sadly there are no officially provided binaries for SDL_gfx (unlike most other SDL_* libraries), and so I had to compile it myself. SDL_gfx, however has just about no documentation telling you how to do this - and the methods provided doesn’t even work.

Since it took me a while to get this working, so I thought I’d write it down for future reference.

1. Download and unpack the source package.
2. Rename *.c to *.cpp. This is to solve what seems to be this bug, that supposedly was fixed in VS6.
3. Extract sdlgfx.vcproj from ‘Other Builds\VisualC7.zip’ into the source directory and open it, and go through the Conversion Wizard.
4. Remove the source files from the project, and then add the *.cpp files and the *.h files to the project. This is needed because the paths in the original project file are incorrect.
5. Change target to Release.
6. Add SDL.lib to Linker -> Input -> Additional Dependencies in the project properties.
7. Add BUILD_DLL to C/C++ -> Preprocessor -> Preprocessor Definitions.
8. In SDL_gfxPrimitives, replace

#ifdef WIN32

__inline long int
lrint (double ftl)
{
int intgr;
_asm
{
fld flt
fistp intgr
};
return intgr;
}

#endif

with

#define lrint(x) (floor(x+(x>0) ? 0.5 : -0.5))

(As per this site)
9. Compile, and save the solution somewhere when asked to.
10. There should be 4 compilation errors, all of which can be solved by using static_cast<>():
SDL_rotozoom.cpp (Line 501) becomes:
pc = static_cast<tColorRGBA*>(dst->pixels);
SDL_rotozoom.cpp (Line 657) becomes:
pc = static_cast<tColorY*>(dst->pixels);
SDL_gfxPrimitives.cpp (Line 3105) becomes:
sab = sqrt(static_cast<double>(a2 + b2));
SDL_gfxPrimitives.cpp (Line 4289) becomes:
currentFontdata = static_cast<const unsigned char*>(fontdata);
11. Compile. The project should now compile correctly, and you will find sdlgfx.dll and sdlgfx.lib in the Release sub-folder of your source directory.

Now, this is all good, but I would really prefer either official binaries, *or* fixes to the code problems, and instructions that are actually up to date.


Since there was interest I’ve now uploaded my binaries as well. It’s SDL_gfx-2.0.17 compiled against SDL-1.2.13, and can be downloaded here.

15 comments » | Computers

Flash cycler

June 15th, 2008 — 1:22am

Since I had a some time on my hands I decided to make a web page that cycles through a collection of flash movies and shows each one for a specified amount of time.

It should work in most modern browsers - I’ve verified with Opera and Firefox (Internet Explorer doesn’t work).

You can find the source of the page here, and a sample of it in use here.

1 comment » | Computers

Super smash bros: Brawl (USA) on PAL Wii

April 17th, 2008 — 1:48pm

I finally got SSBB working, and here’s how. But let’s start with what does NOT work.

First, my setup:
PAL Wii with latest firmware (Bought on the release date)
WiiKey (Firmware 1.9s)

Try 1 (No go):
Enabling update blocker on the WiiKey:
Doesn’t work, from reading a litte on the net I found out that you have to enable dev mode as well.

Try 2 (A bit better):
Enabled dev mode as well as the update blocker on the WiiKey. The disc loads correctly, but when you try to start it you just get a black screen.

Try 3 (Almost there):
Got a tip to try it in 50hz mode. Did that, and… it works. However the game runs awfully slow, and you get audio artefacts from some sounds which means it’s not really playable.

Try 4 (Success!):
Decided to try FreeLoader for Wii. I disabled update blocker and dev mode on the WiiKey, and changed back to 60hz.
First I went to the disc screen and inserted the FreeLoader disc and waited for it to load (you may see some graphic artefacts during this time). Then I ejected the FreeLoader disc and inserted my SMBB disc and started it. And it worked fine.

If you get a white screen saying the disc can’t be read after the “Loading…” message you’re propably suffering from a bad burn.

3 comments » | Computers

Self Injury

March 5th, 2008 — 2:51am

Posting this since it’s relevant to past experiences, and because I think it’s important to know about it. I strongly encourage you to read it.

Comment » | Life, Society

Ruby’s GNU readline module

February 25th, 2008 — 8:36pm

One thing I really don’t like is libraries that lacks documentation. Which, incidentally, is exactly what ruby’s readline module does.

Happily, however, I found this post which explains at least the basic usage - thank you, Adam!

2 comments » | Computers

Bits and pieces

February 7th, 2008 — 4:43pm

These are some interesting links I’ve picked up during the past months. Some of them are quite old, so don’t be surprised if you’ve already seen some of them.

Let’s begin with how robots could be looking at humans.

And then a pair of personality related articles: a few things you should know about introverts (that’s me). And also a comparison, if you will, of the Wide/Deep personality types.

I found 10 Attributes of Really Lazy People quite entertaining.

And some reasons as to why I will never get an facebook account. Another, less serious, but still valid view on the same topic.

If you feel like you have too much time on your hans you could always do what this guy did: write a ray-tracing renderer from scratch.

Here’s some interesting views on today’s CS education, though I’ve not personally seen all those changes where I’m studying. It also presents a few things that are important for CS students to learn (more specifically in the programming area).

And at last, a nice explanation as to why writing general applications isn’t always the right choice.

Comment » | Random stuff

Back to top