Archive for the 'MacOS X' Category

Hacking youtube videos for iPhun (and profit)

If you’re not an iPhone owner, then you’re probably not going to be interested by this post. If you don’t like custom ringtones then you’re definitely not going to be interested by this post. If you’re still reading, I’ll explain you quickly how to convert youtube videos to iphone ringtones.

This is basically going to be a quick walkthrough rather than a long explanation. Basically you need a way to download the youtube video (like youtube-dl) and ffmpeg compiled with faac support.

For FreeBSD users, this is as simple as installing the two ports: net/youtube_dl and multimedia/ffmpeg (make sure to run ‘make config’ and check that FAAC is on). For MacOS X users, the easiest way will be to download youtube-dl to your home directory (and put it in /usr/local/bin if you wish) and install ffmpeg following these instructions. Windows users can install iRinger (haven’t tried it but it looks quite nifty).

Ok, now for the actual information (this is actually pretty easy).

First, find a video you like (in my case, Bird is the word in Family Guy) and download it.

$ youtube-dl 'http://www.youtube.com/watch?v=2WNrx2jq184'

Then drop the video part and convert the MPEG stream to AAC.

$ ffmpeg -i 2WNrx2jq184.flv -f ipod -vn birdistheword.m4r

Alright, that’s it! Wait, I want to get rid of the first few seconds and the last few seconds as well. Let’s just play it in mplayer (or QuickTime, or iTunes) and find the offset (-ss option) then the length (-t option). The -y option is to force overwrite the output file.

$ ffmpeg -i 2WNrx2jq184.flv -f ipod -vn -ss 28.6 -t 44.2 -y birdistheword.m4r

Once this is finished, just send the ringtone to the iPhone, either using scp if your iphone is jailbroken (put it in /Library/Ringtones/) or via iTunes (just drag and drop it in Ringtones, then sync the iPhone). Enjoy!

Desktop experience improvements on FreeBSD

As you should know if you’re a FreeBSD on desktop user, Gnome 2.16 has been committed to the FreeBSD Ports Tree few days ago. Being a Gnome user myself, I upgraded from 2.14 to 2.16 as soon as I had a little free time. To say the least, it’s been quite painful (I’m not blaming anyone, that’s just a fact, I don’t really care if I need to spend 2 hours checking what’s wrong and how to fix, really). If you haven’t yet upgraded, you might have problems related to the PREFIX change (Gnome moved from X11BASE to LOCALBASE, which by default are respectively /usr/X11R6 and /usr/local). You can also experience problems with duplicated origins, which means, you’ll end up with package X-2.14 installed in X11BASE and X-2.16 in LOCALBASE. Depending on whether dependant packages check libraries and header files in X11BASE or in LOCALBASE first, this might break the build. Anyway it’s done now and there won’t be a PREFIX move again (for Gnome at least).

Note: I’m reinstalling my laptop with FreeBSD 6.1-RELEASE and a fresh Ports Tree. Though it’s not over yet, I’m pretty sure it’ll be ok. If you’re installing a new machine, set X11BASE to ${LOCALBASE} in make.conf and symlink /usr/X11R6 to /usr/local. Be aware that you may have some not-yet-discovered CONFLICTS arising (some X package overwriting files from package Y).

So what’s new in 2.16 for FreeBSD. Well, if I had to give only one name, that would be HAL. HAL stands for Hardware Abstraction Layer. Read the freedesktop page, it’s not wasted time. Now, things just works. When you plug your USB key, the HAL daemon will mount it and nautilus will pop-up a browsing window. When you insert an audio CD or a DVD, totem will start and play the content (well, doesn’t work here at the moment, but that might be a local problem). That’s a basic feature, Windows has had it for years now, but that’s definitely a step in the right direction. What next? D-BUS. Well, it’s not really new, but more and more applications are using it. D-BUS is a mean for applications to communicate with each other. For example, now Evolution is sending a D-BUS message everytime it receives a new mail (via a plug-in). Then it becomes very easy to write a small app that listens on the bus and uses libnotify to show a pop-up everytime a message is sent (actually, there’s already a PoC here).

Last year I got a PowerBook G4 which I’m playing with on a regular basis. The killer-apps I found were Expose, Spotlight and the Dock. Expose is Apple’s software that “expose” all your windows at the same time, it’s a good replacement for Alt-Tab that uses the mouse instead of the keyboard. It’s only really useful if you combine it with sensitive corners otherwise you have to use both the mouse and the keyboard. Spotlight is an integrated search engine, that finds almost everything indexed related to keywords (like your mails if you’re using Apple Mail, files, applications, ...).

Since I try to be on the bleeding-edge when it comes to shiny new UNIX features (not that I understand everything, far from it), I read about new features/applications in the X domain (XGL, AiGLX, Compiz, Beryl, ...), I saw the Beryl has its own version of Expose (*hint*: search beryl+aiglx on youtube). Yay, problem is, we don’t have a recent X.org and beryl in ports (may come as an Xmas present :-) ). Ok, I’ll wait for this one. Next. Some months ago, I read about Beagle, a project similar to Spotlight. It indexes your stuff, and you can then make queries. Problem was at that time, beagle depended on a kernel with inotify support (which is completely Linux-centric). Well actually, it doesn’t depend on it, but that’s unusable without it. Then some people (jylefort@, IIRC) wrote a kqueue replacement. And there was much rejoicement. I tested beagle yesterday evening, and besides few crashes and some things I don’t understand yet (supposed to index Evolution mails but it doesn’t), it seems to work pretty well. Grin, that’s another win. Then what can we use on Unix, us, Dock-lovers. I need to say that I hate Gnome panels, really. At some point, I used a gdesklets plugin, and though it was really nice at that time (2003 IIRC), it was eating all my RAM. Meet akamaru. As you can read, the initial goal wasn’t to create a dock. This is just awesome, and I mean it, have a look at youtube again and search for kiba. Agreed, you don’t need all these effects, but that’s what makes it awesome. I tried it few weeks ago and the configuration of the dock wasn’t really straight-forward. I had to edit a shell script that wrote gconf entries I think. It seems kiba-dock is a fork of the demo-dock, I’m not sure. Anyway, it doesn’t seem to work if you don’t have XGL or AIGLX with compositing enabled. Anyway, things are really getting better and it’s not hard to conceive that all those Windows replacements (Ubuntu, Fedora Core, SLED) will gain a lot of popularity in the next few months/years.

Vim and TextMate

Yesterday while cleaning my hard drive, I found the 20MinutesWiki video that presents TurboGears I downloaded some days ago and watched it. It’s quite impressive but what I seen besides technical stuff was the editor Kevin Dangoor (the presenter) was using : TextMate. It had some completion features that seemed quite nice. So, as a vim user, I decided to look if someone already wrote such a plugin and finally found it!

As an example, you can add this to your ~/.vim/ftplugin/c.vim (you need to change delimiter to ‘?’) :


Iabbr inc #include "?file?.h"^M??

There are some issues though, the most important being it breaks the indentation (well, you can still use Ctrl-F).