Ebuild for yubikey pam auth

(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.

Posted in Computers | Tagged , | Leave a comment

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


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.

Posted in Computers | 20 Comments

Flash cycler

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.

Posted in Computers | 1 Comment

Super smash bros: Brawl (USA) on PAL Wii

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.

Posted in Computers | 3 Comments

Ruby’s GNU readline module

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!

Posted in Computers | 2 Comments

ryara.net v3

I’ve yet again remade my website (second time this year), and I think it looks better than the older two.
New for this version is a new PHP backend for the portfolio part, which I’m quite happy with. Eventually I’ll probably release the source for it, too.

I’d also like to thank Andreas Viklund for the template I used, and friends of mine for help with a few design decisions.

Posted in Computers, Random stuff | Leave a comment

SvsG source released

Yep, I’ve decided to release the source of the game SvsG that I made together with a classmate quite a long time ago. It’s released under the MIT license, and you can find it here.

I haven’t cleaned up the directories, but it should still be usable (otherwise you could just import the important files into a new project).

It should also be noted that I consider most of the code not to be very well written. But it’s still usable. ;)

Posted in Computers, Random stuff | Leave a comment

Now playing for irssi using Last.fm

You sometimes want announce what music you’re playing on IRC, but when using irssi on a remote server this becomes something of a problem. Therefore I wrote a script for irssi that track info for the currently playing track from last.fm, and prints it to the current channel.

To use the script:
1. Get it and place it in your ~/.irssi/scripts folder.
2. Optionally place a symlink to it in ~/.irssi/scripts/autorun directory to load it automatically when you start irssi.
3. Edit the file and change the $lastfmuser variable to your Last.fm username.
4. Load the script in irssi: /RUN npScriptLastFm.pl
5. You can now use the script by using the command /np

As written in the file itselft it’s distributed under the MIT license.
Hope you’ll find it useful.

Update 2: It is no longer recommended to use this script. See this comment for details and a better alternative.

Update 1: Thanks to Salminen (see comments), the script should now be working, I’ve updated the link so it points to the working version.

Posted in Computers | 13 Comments

Flashing taskbar with PuTTY + irssi + screen

As quite many people do, I use to IRC using screen + irssi on my server, which I connect to using PuTTY. A little while ago I went out to find a way to make PuTTY’s taskbar flash when I was hilighted. It wasn’t trivial to find the information on how to do it (it took me some time), so I though I could share it:

In irssi:
/set bell_beeps on
/set beep_msg_level MSGS NOTICES DCC DCCMSGS HILIGHT

And in putty:
Go to Terminal -> Bell in the settings, and set “Taskbar/caption indication on bell” to Flashing or Steady (whichever you prefer).

That should be it, and don’t forget to save the session settings in PuTTY so you don’t have to change them every time you connect ;) .

Posted in Random stuff | 8 Comments

Rhythmbox 0.11.0 with new style Last.fm support for Gentoo

This is something I’ve wanted for quite some time: the new style Last.fm plugin takes Last.fm integration to Rhythmbox. Download here. You can install it by following these steps:
1. Add PORTDIR_OVERLAY=”/usr/local/portage/” to your make.conf
2. Run ‘mkdir -p /usr/local/portage’
3. Download the ebuild package from the link above and unpack it: tar xvjf new-style-lastfm-ebuild.tar.bz2 -C /usr/local/portage/
4. Emerging rhythmbox as you normally would.

And that should be it. Also, as the author of the patch writes, remember to only have one of the Last.fm plugins enabled at any time.

Posted in Computers | Leave a comment