Quick, I need to burn on a headless system

I need to burn a DVD on a system without display. OK there is ssh -X but I want to avoid the click-clickety-click.

I did so, and blog about it in case I need those bits back in the next coming monthes/year.
  1. Create the iso
    • Copy your files in a root directory — make sure the final size is OK
      • DVD is fooling with you since 4,700,000,000 / 1,024 / 1,024 / 1,024 = 4.377GB and not 4.7GB
    • mkisofs -J -R -o isofile.iso ./directory
    • Verify the iso: mount -o loop -t iso9660 isofile.iso /tmp/iso
  2. Burn the iso
    • wodim isofile.iso

Happy Burningeleven1!


Marihela update

Today I was working around Marihela, and I already had the idea of what to do. It is incredibly awe-some to work with an external display. There was enough space for a well sized xzoom, gimp, and full sized terminal (shade/unshade ^_~). You can check out on my gallery.

If you wonder what the GTK+ theme is, it is Aurora-Midnight.

Download Marihela.tar.bz2.

Update: The most recent version of Marihela can be snapshotted from my gitweb interface.



Celestia is a beautiful piece of free software. You can across the space with a speed of thousand astronomical units per hour, discover the outbound of our galaxy, and take the most beautiful shots ever. This is a game I will always like ^_^

Just today I took a trip around Saturn and its nice ring. Next I was looking for wallpapers for my dual head (1280x1824) and captured images from Venus, Mars, the Moon with the Earth, and so on…

You can check my desktop with Mars. The quality and the number of details are really impressive.


Easy remote access with Thunar

Update: This is deprecated in favor of gvfs.

Networking support is a hot topic in Thunar, and the most probable answer to a user will be one of the many FUSE tools. For Samba you can use fusesmb. For fish protocol and the like you can use sshfs. The benefit of a FUSE tool is that your remote data is accessible as it were on your file system. This results in the fact that all your applications can access the data, and not only the applications that implement a special API. There is never a need for high privilege, so every user can mount remote data from machines where they already have access. To unmount a fuse file system use the command “fusermount -u /mount/point”.


Here is a little usage example for fusesmb to show how easy it works.
% fusesmb samba
% ls samba
% ls samba/MASSONNET
% ls samba/MASSONNET/M8T
share music movies cdrom
And if the listed networks are empty or outdated run the fusesmb.cache command:
% fusesmb.cache samba


As a prerequisite use an authentication with keys — there are tons of HOWTOs for that and I just picked up that one — otherwise you will be prompted for your password and this is a no-go for a Thunar custom action, unless you set up ssh-askpass…

Sshfs works as simple as “sshfs user@host: /mount/point” to mount the home directory from user on host. I arranged me a tricky Shell script to ease the mount even more. The script takes the hostname — the SSH server — and no further arguments. The hostname is also used as mount point, so you can basically have one directory with several sub-directories, each named after your remote hosts. If the mount point doesn't exist it is created on the fly.
% sshfs.sh /sshfs/m8t
% sshfs.sh /sshfs/someuser@funkyhost
% sshfs.sh myhost.mine.nu

Thunar's Custom Actions

Thanks to the custom actions in Thunar, you can implement a lot of features on your own. I use the sshfs wrapper script to mount remote hosts. See how easy it is to set the next custom action up:

The custom action simply calls “sshfs.sh %n” with the name of the directory. To unmount, you would create a custom action with the command “fusermount -u %f”.


Some environment decision on my server

It's been a while since I didn't use my server with a decent environment, in fact it was running for months inside a simple tty just to do the basic stuff. A tty isn't that bad, you can control your MPD for example to stop the music or to set up the entire playlist. It is also sufficient for configuration files, and browsing on the WWW for information…

All was fine until my light bulb gave up. Of course I changed it, but with one that had additional 20 watts, and I wasn't happy for the lamp getting warmed up too much. So I choose to light up my hacking space with my server's display. What I was looking for was something with animations… nonono! not that one, plzkthx! The best I can think of is E17 ;-) It has the bling bling that no other environment has.

So I was getting started with E17 again, which I didn't use for hardly two years. The first day was mostly OK, I played with it and tried out different modules — the photo module is nice — and I also ran through bugs and crashes, but nothing blocking. The next day, I tried out more modules and locked myself inside my environment because of the “First Run Wizard” module which states in its description “WARNING!! DO NOT USE!!” which I didn't see -_-

So I talked a bit in #e and raster showed me the enlightenment_remote command to control parts of E17. I just didn't get how to export the E_IPC_SOCKET variable but now I do! So I finally decided that it was easier to delete the main configuration file which was actually a good thing because after that I had more options than before :-)

The desktop is now all simple and beautiful and shiny and lighty and blinky and decent. I have my workspaces with different tasks like music player, IRC, a web browser (Midori), and so on. My last addition is a simple script to put inside my cron table which switches the background. I run it every 30 to 60 minutes, depends of my mood. I really like the smooth background changes in E17 :-)

Light is back, fun is in too.


Use Epiphany to set your xfdesktop background

Hi ladies ang guys,

As of my blog entry auto-update-background-list-for-xfdesktop I used to tell how I update my background with a uniq file in the background list. That worked with a shell script that 1) took as argument an image file 2) updated the background list 3) and reloaded xfdesktop.

I updated that script and put it in my git (git.m8t.mine.nu). It can now take a remote file as argument. That combined with the web browser Epiphany, you can apply a background within the browser.

Download that script and make it executable inside your $PATH.

Now run Epiphany with the extensions then:
  1. go to Tools > Extension... and enable the Actions extension
  2. After the Actions are enabled go to Edit > Actions
  3. Press Add and create an action called "Update xfdesktop background"
  4. And set the command to "set-xfdesktop-image.sh"
  5. Check Images in the Applies to
  6. Click Add.

Now go to my wallpapers gallery, choose a wallpaper (click on it to get the fullsize), and right click it. You can apply it by choosing the item "Update xfdesktop background" in the context menu.

Have fun with my hack around xfdesktop,


Marihela Xfwm theme

I relooked a little bit the Moheli theme with some ideas that throwed my head.

You can go to my gallery, the last screenshots are the most recents. Pick this one.


Dwarf GTK+ theme for Xfce

I was using the Xfce-stellar theme for quite more than a week now. Today I renewed that theme by using the most recent features from the Xfce GTK+ engine like gradients and borders for menu items.

It was an easy hack since both the Xfce-stellar theme and the new default for Xfce are really clean. I mostly changed colors and some other misty stuff. I choosed the name Dwarf, coming from the White Dwarf, since it has a direct relation to Stellar. If you like the next screenshot you can download the theme here: Dwarf.tar.gz.

Edit: I have done some updates while I was travelling by train. There is a gallery with several screenshots and the tarball has been updated too.


My Google

I try new features from Google's website as they come out. So, I was looking for a little bit of ascii-art and I replaced my notes $google_module default's message with a nice ascii-art.

Here is my Google page:

The theme changes with the time of the day. Guess what, it is night (time for the theme to cycle)!
Note: However I dislike the privacy issues with Google like the search history, or the $dont_empty_your_mail text.


Shell exercices

Wanna convert a pdf to images and create a gallery. Well, I had some actions with that and I did my way through the GNU, and other, utilities.

1. First
You need to convert the PDF document to images. Not so easy, there is pdftohtml but it doesn't generate images, instead it extracts the text and images from the document. However there is ImageMagick, a great project, which provides convert. So I ran a convert file.pdf file.png but I couldn't figure out how to preselect the size to get bigger resolutions. After that I have opened file.pdf with xpdf and I took screenshots with scrot from the xpdf window.

2. Crop images
I cropped the images to remove the borders and toolbars with for image in *.png ; do convert $image -crop 150x150+30+20 ; done where I selected the geometry of the crop size in GIMP within the dialog of the crop tool.

3. Rename files
Next I figured out how to rename files, and how to bulk rename (Thunar -B) them better.

4. Finally
I have found photon --thumbsize=50x50 --sizelist=0 -o photon ../images which creates nice web galleries. With javascript, you can view the presentation as in a pdf reader, by pressing space to switch pages.

However there is a bug, fortunately this blog entry will remember me to file it upstream. My images are png files, and it creates jpeg files. The original files are copied verbatim without modifications, but the html files contains source images only with .jpg extensions. Bad, because I have png files...

5. A last one before to go
for html in *.html ; do cat $html | sed -r 's,(original)/([0-9]+)-(projet-tuteure)\.jpg,\1/\2-\3.png,' > $html ; done


You can see the result of photon if you are interested.

Edit: Just in case I forget about it and would need it again... photon --thumbsize=105x105 --display-lines=4 --sizelist=0 --resize-quality-low=95 --img-bgcolor=#ffffff --body-bgcolor=#2e3436 -k steel -o photon ../images && cd photon && for html in *.html ; do cat $html | sed -r 's,(original)/([0-9]+)-(projet-tuteure)\.jpg,\1/\2-\3.png,' > $html ; done && cd ..


Wanna download a YouTube video?

If you want to download a YouTube video it is really easy with the shell. All you have to do is to pick up the video_id in the URL and feed it to the script. It will then fetch the valid URL to download the flv video.

But that's not why I want to blog about it because there are already scripts to download YouTube videos. The reason I'm blogging is because it is a one-liner.

wget "http://www.youtube.com/get_video?`wget -q -O - "http://youtube.com/watch?v=$1" | egrep -m1 -o 'video_id=[^&]+&l=[0-9]+&t=[^"&]+'`" -O $1.flv

Note: $1 is the video_id parameter sent to the script.

Download the script.


Random MAC address

I just thought I had need to blog about that, a script to generate a random MAC address. It is based on $RANDOM from any shell and works reliably.

#! /bin/sh
# Generates a random mac address
echo $RANDOM | openssl md5 | sed 's/\(..\)/\1:/g' | cut -b0-17



Set the proxy for GNOME

I like surfing with Epiphany over the bloated Firefox but it doesn't provide a setting dialog for the proxy. It is configured system wide with gconf. A nice editor to have a quick look at the settings is gconf-editor and once you know what to set you can use the command line tool gconftool-2.

Here is a script to switch the proxy on/off with an optional host and port.

#! /bin/sh
# Switches the GNOME proxy on/off and
# can take an optional proxy host+port

usage ()
cat << CAT
Usage: `basename $0` on|off [host [port]]
exit 1

[ $# -lt 1 ] && usage

case "$1" in

gconftool-2 -t string -s /system/proxy/mode "$mode"
[ ! -z "$2" ] && \
gconftool-2 -t string -s /system/http_proxy/host "$2"
[ ! -z "$3" ] && \
gconftool-2 -t int -s /system/http_proxy/port "$3"

As usual you can follow the changes at mykey57.free.fr/pub/misc/bin/.


MPD repeat track

I have written a Shell script to repeat the current track of MPD. The daemon doesn't provide this feature because it isn't seen as necessary, however I love (sometimes) to stick with the same song. Most people will suggest you to run mpc crop && mpc repeat on && mpc play ^_^, but that kills you playlist and I really want to avoid it.

There are two scripts, one to repeat the track when it has to be done, and a daemon which restarts the repeat process if the user changes the current track. Note: the daemon doesn't take care if you seek in the track, so... if you had like to repeat the same track and seek into it just hack the script and why not leave a comment with your modifications.

The repeat script

# Repeat the same track

function repeat ()
min=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f1`
sec=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f2`
tmin=`mpc --format %time%|head -1|cut -d: -f1`
tsec=`mpc --format %time%|head -1|cut -d: -f2`
sleep $(( ($tmin*60+$tsec) - ($min*60+$sec) )) && mpc prev && repeat


The daemon

# Daemon which takes care of restarting the repeat process
# if the user changes the current track

function restart ()
killall mpd-repeat-track.sh


while sleep 2
current=`mpc|head -1`
last=`cat $file`
echo $current > $file
[ x"$current" != x"$last" ] && restart

Now run mpd-repeat-trackd.sh and it will just work<tm>.

You can follow the changes here:

Old links:


Deactivate PHP for a container

Since I have set up a File-center on my web server, I never thought about deactivating PHP for the public folder. Now it is done and it is a one line directive. Run "echo SetHandler send-as-is > /to/your/root/public/folder/.htaccess".



If you want to watch daily comics, but need to load the pathetic 206KB of content for the 37KB image, you can script the download of it with curl and egrep.

# Download comics and put them in the users web directory

if [ -z "$1" ]
DATE=`date +"%Y%m%d"`
IMG=`curl -s http://www.comics.com/comics/pearls/archive/pearls-${DATE}.html \
| egrep -m 1 -o "/comics/pearls/archive/images/pearls[0-9]+.(gif|jpg)"`
mkdir -p $HOME/public_html/comics/
cd $HOME/public_html/comics/
wget -q http://www.comics.com$IMG

And there you go. You will download the 53KB HTML page and fetch the 37KB image which makes you a ratio of 0.44:1.

The script downloads the comics of the day by default, or you can pass it a date as first parameter. A good place for this script is your cron table.

I'm gonna improve this script each time I find a new comic now on.

Edit: you can follow the changes here.