2006-12-23

Random background

I've make up a script to set a random background onto the root window. You must initialize the variable DIR to your backgrounds path.

#!/bin/sh
# This script helps to set a random background from $DIR onto the root window

DIR="$HOME/picture/Fonds/"
RES=$(xwininfo -root|grep geometry|cut -d' ' -f4|cut -d+ -f1)
MAX=$(find $DIR -type f | wc -l)
NUM=$((RANDOM%MAX+1))
BACKGROUND=$(find $DIR -type f | head -n $NUM | tail -n 1)
TEST=$(identify "$BACKGROUND" | grep "$RES " | awk '{print $1}')
test ! -z "$TEST" && xsetbg "$BACKGROUND" || $0

You can modify it as you want, for instance comment RES to take all the backgrounds, even smaller or larger than your screen resolution, or set options to xsetbg like -fullscreen.

2006-12-13

SSH through Apache Proxy

If you want to connect you to your beloved SSH server, but you are stick behind a proxy which has only ftp, http, and https open, then you can install proxytunnel. It is a super tool :)

1) You will need apache on port 80 to "proxy" your SSH connection. 2) Create an "easy-to-run" ssh client. I assume you know how to install Apache webserver... so go open/create your VirtualHost.

For Apache you will need the modules mod_proxy (splitted into two files in the httpd tarball: mod_proxy.c and proxy_util.c) and mod_proxy_connect (to allow SSL connections). I use the Apache2 Debian package, so all this stuff is really simple.

Apache configuration example:

NameVirtualHost nameserver_or_ip:80
<VirtualHost nameserver_or_ip:80>
ProxyRequests on
ProxyVia on
AllowCONNECT 22 5554 # by default SSH listens
# on 22, but you can also
# make it listen on a secret
# port for example like 5554;
<Proxy *>
Order deny,allow
Deny from all # By default reject everyone
Allow from localhost
Allow from the_fixed_ip_of_your_university
</Proxy>
ProxyPass /debian http://ftp.fr.debian.org/debian/
# A useless example of ProxyPass to show how
# to be able to connect to the debian ftp since
# http://your_host/debian/

Redirect / http://www.somewhere.com/
</VirtualHost>

Restart your server.

Now edit ~/.ssh/config and get inspired from the next lines:

Host proxy
DynamicForward 1080
ProxyCommand proxytunnel -v -p localhost:81 -r myhost:80 -d localhost:13375
ServerAliveInterval 30

-v is verbose, -p is the proxy to use (the one of your university for example), -r is the remote proxy (your Apache server), and -d is the SSH server to connect to. Note that if your SSH server is on the same as Apache, you can connect to localhost. However I prefer to put the DNS of my server so the message "Last login from" is less ambiguous.

Save this file and exit. Now you can type `ssh proxy' to connect through the hell of proxies.

Screenshot of an SSH connection through a local Apache proxy through a remote Apache proxy:

lapt0p[100]:~% ssh local
localhost is 127.0.0.1
Connected to localhost:81
Tunneling to myhost:80 (remote proxy)
Connect string sent to Proxy: 'CONNECT myhost:80 HTTP/1.0
Proxy-Connection: Keep-Alive

'
DEBUG: recv: 'HTTP/1.0 200 Connection Established
'DEBUG: recv: 'Proxy-agent: Apache/2.0.55 (Ubuntu)
'DEBUG: recv: '
'Tunneling to localhost:13375 (destination)
DEBUG: Send: 'CONNECT localhost:13375 HTTP/1.0
Proxy-Connection: Keep-Alive

'
DEBUG: recv: 'HTTP/1.0 200 Connection Established
'DEBUG: recv: 'Proxy-agent: Apache/2.2.3 (Debian)
'DEBUG: recv: '
'Starting tunnel
Linux myhost 2.6.15-1-amd64-generic #2 Mon Mar 20 10:43:41 UTC 2006 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Dec 13 21:19:24 2006 from localhost
myhost/ssh[45]:~%

2006-11-24

How to write a screen presentation

If you are looking for a way to write a screen presentation you probably think about PowerPoint, or hopefully OpenOffice Impress. But such an application is t' suck to load. Actually all you need for a professional and beautiful presentation is a simple text editor.

Beamer is a LaTeX package which helps to create a PDF presentation. You will select a theme for the presentation, and type the titles, the sections and/or subsections, add some lists and the content.

To install Beamer on a Debian system type apt-get install latex-beamer.

Next try to "compile" this LaTeX example into PDF with the command pdflatex:

% example.tex
\documentclass{beamer}
\usepackage[utf-8]{inputenc}
\usetheme{Berlin}

\title{Wireless Networks}
\author{P. Pepin, M. Massonnet}\institute{IUT Nancy-Charlemagne}

\begin{document}

% A nice frontpage
\frame{\titlepage}

% Followed by the outline
\section[Outline]{}
\frame{\tableofcontents}

\section{Panorama of technologies}
\frame
{
% This is an animation
\begin{itemize}
\item<1-> Bluetooth
\item<2-> UMTS
\item<3-> Wifi
\end{itemize}
}
\frame
{
\frametitle{Bluetooth}
caca
}
\frame
{
\frametitle{UMTS}
pipi
}
\frame
{
\frametitle{Wifi}
cucul
}

\section{Local wireless networks}
\frame
{
\textsc{Beamer}, is really beautiful!
}

\section{Network protocols}
\frame
{
And it's easy.
}

\section{Security}
\frame
{
\begin{itemize}
\item<1-> Easy
\item<2-> Fast
\item<3-> Simple
\end{itemize}
}

\end{document}

Brilliant! Isn't it? ;-)

2006-11-20

Auto update the background list for Xfdestkop

I have written a quick script to update the list of the images for the background in Xfdesktop.

#!/bin/sh
# Update the background.list so the new downloaded wallpapers are available
# to show up in Xfdesktop.
LIST=$HOME/.config/xfce4/desktop/background.list
echo "# xfce backdrop list" > $LIST
find $HOME/images/background/ -type f >> $LIST

Note: change in the last line the folder to the backgrounds.

This script can be either putted in an .zshrc file. Or better, if you use Xfce, save the script, under the name update-desktop-list.sh for example, to your personal bin folder (in my case $HOME/.local/bin) which is correctly set in the PATH, and run xfce4-autostart-editor. You can add the command update-desktop-list.sh.

Finally you have to set up Xfdesktop to use the list (located at $LIST) of backgrounds. Go to Settings > Desktop manager, and select the list as the file. If it doesn't exist run the script a first time.

2006-11-11

Real-transparent Terminal (yet again)

I have looked around the patch for gnome-terminal from Kristian Høgsberg and also the one for Terminal from Benny, and I managed to do the same for Terminal again since the vte libs have been modified, and support for real-transparency has been added. It was really simple, just init the rgba colormap, and call vte_terminal_set_opacity :) It requires version 0.13.3 or higher of vte.

Now someone could come with a good solution to integrate this nicely in Terminal. I think about a hidden option in ~/.config/Terminal/terminalrc, or even a slider.

Here is a first patch. It sets a hard-coded color for the alpha channel (0xDDDD).

Edit: And here comes a second patch which adds a hidden option for the opacity (ColorOpacity). It has to be in decimal, where 0xCCCC is 52428. Don't apply it over the first patch.

Edit 2: Benny commited changes to the trunk with support for real transparency, and a check for the version of libvte.

Screenshot Terminal

2006-11-01

File-center

I have finally rewritten my File-center project. It is a simple interface to download and upload files. Now I use Smarty for this project and the default template is really nice. The scripts for download and upload are simple too, and you never need to get to another interface. You just upload a file, and next it appears in the current working directory. If you want to download a file, the page will be reloaded and the download will start within 3 seconds.

It is on Freshmeat.net/projects/filecenter/ but the webpage of the project is hosted on my french homepage.

White & Nerdy

"Weird Al" Yankovic's music video from his new album "Straight Outta Lynwood" (in stores Sept. 26)

It is "yet another" great video from Yankovic :)

2006-10-15

DokuWiki

Hi, long time gone since my last post. Well, I was not doing "nothing", it's just annoying to blog until it is worth ;-)

I started to take my notes from school with Zim. It's a nice desktop wiki, simple and fast, which writes text files that can be sorted in a tree. It does a really nice job. I'm getting used to Inkscape also, because I use it to draw the schemes and so on.

After awhile I wanted to provide my notes on my website, so I started looking for a Wiki, 1) which writes to text files, 2) which supports more or less the same wiki syntax, 3) which is easy to update when I make changes from Zim.


I figured out DokuWiki, already used by two Xfce projects (Goodies and Thunar). The installation is really easy: download the latest version (currently there are RCs) from here, extract the tarball inside one of your web directory, and launch install.php. One click and you can start with the wiki :-)

I tested some stuff around, and I have get really good help from Christopher on the ##dokuwiki channel at Freenode. Thank you dude :)


First I configured a bit more DokuWiki, these are some of the settings I am using:
$conf['userewrite'] = '2';
$conf['mailguard'] = 'visible';
$conf['mediadir'] = 'data/pages';
$conf['mediaweb'] = 'data/pages';

The configuration userewrite allows to use pretty URLs. With its value set to 2 you can have URLs like http://host/wiki/dokuwiki.php/directory:file. With 1 you can use URLs rewrites from Apache or Lighttpd which removes dokuwiki.php from the URLs. With 0 the pretty URLs are not used.

mailguard obfuscates the emails in the way to avoid spam.

Finally, mediadir and mediaweb, are set to the same directory as the pages. I did so to simplify synchronization between the Zim and the wiki. With this setting I just have to connect to FTP with lftp, cd into the pages directory and run mirror -R.


I needed to get a syntax working with the one written by Zim. There is a plugin Creole available which has the same syntax for the lists, and does proper breaklines for each end of line, I just had to remove the heading tho. You can download it here. Note that I still need to have a look at it for some formatting.


Finally I integrated a sitemap into the default theme with some piece of code from indexmenu plugin. You can download the theme here.


You can visit my DokuWiki at http://mykey57.free.fr/asrall/.

2006-09-05

Note to webmasters

I was watching the statistics of my website, from free.fr, when, *wohoo*, I have seen there were over 10000 visits in the last month. What's happening there? My website? 10000 visits? Something _is_ wrong!

After I've check out the facts, a website was using an image directly from mine. That sucks, and this webmaster is just an idiot. I was looking around his website to get contact with him, but, WTF is his email?! Nothing here, nothing there. OK! I have a radical solution to get him to drop the image.

At this point you could be shocked if the name "g0atse" is something you don't know. So please don't open the next links I will print. The icon in question was no more used in my website, so I had just to create a special image for replacement >:-) I did, and voilà the result: comar.gry-online.pl.png. It took less than 6 hours before he dropped the image, actually he uploaded the original image to imageshack.us. Still an idiot.

So, webmasters, do NEVER use an image directly from another website, it could be dropped from a day to another, or even worse...

2006-07-20

One month without any message

I was busy. And I'm still busy.

I'm coding a new xfce4-notes-plugin for the new panel (version 4.4). It is fun :) I already have access on the webpages and the svn (or I guess so, I'm working on a local subversion at the moment). Should be released at end of the week, actually when I will add the on_delete_page callback. It supports multiple notes and some options for the window aspect (always on top, stick, show in taskbar, show at startup).

Also, I was at RMLL2006, and there was a wet man searching the reception... it was p0llux! After one day I ran sick... because of the heat. I was lug around Vandoeuvre to get in a Pharmacy (thanks guys). I didn't assist any conference all the week :/

See you in the next post about the first release of xfce4-notes-plugin.

2006-06-19

Back off, I have my new (and first) laptop, it is an Asus A8F. I'm very happy, therefore this post.

See you sucker*.

* You dreaming of such a laptop

2006-06-14

mmassonnet += 1 year

Today is my birthday and for this day I have get a nice cake, see here:

2006-05-25

Theming is my actual pleasure

Xfwm4

I did some theming around the original theme of Xfce 4.4.

All I wanted was the title bar to be a bit smaller. I managed to reduce it from 6 pixels. Then I simplified the buttons. The work was quite long with redundant actions, well it is what it is. Now I have my theme :)

I posted my modifications at Xfce-look.org.

ajaxMP

I also did a theme for ajaxMP a little time ago which is based on Xfce-dawn theme (which is my current theme moreover). ajaxMP is a web interface for Music Daemon Player. I already mentionned it in the post "My current apps".

I am also working on a web design in black for a french rap production. They have very good instrumentals and I am sure the CD they are producting will kick ass. However I prefer good old Pink Floyd at this time.

Cheers.

2006-05-22

Feed2rss filter in Python

Hello,

As I am trying to get used to snownews I ran into the need to convert atoms(?) from Blogger.com in rss(?). Why? because snownews only supports RSS. I was telling to myself "YZAH, I'm gonna try out Ruby" but after 2 minutes I (re)turned to Python :)

Feedparser is excellent and is available for Python as for Ruby. It can handle any types of feeds and you will be able to output the information as you want.

The script I wrote can be used by two ways.
  • You can choose between giving it a URL:
    feed2rss.py http://mmassonnet.blogspot.com/atom.xml
  • or passing it the content of a feed through a pipe:
    curl -s http://mmassonnet.blogspot.com/atom.xml|feed2rss.py

#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Parses an atom file and generates an RSS1.0
# Author: Mike Massonnet (mmassonnet) <mmassonnet at gmail dot com>
# License: GNU General Public License 2 and above
# (cf. http://www.gnu.org/licenses/gpl.html)
from feedparser import parse
import sys

if not len (sys.argv) > 1 and sys.stdin.isatty ():
sys.stderr.write ('Usage: '+sys.argv[0]+' <url>\n')
sys.exit (-1)

if sys.stdin.isatty ():
d = parse (sys.argv[1])
else:
d = parse (sys.stdin)

if d.bozo:
sys.stderr.write ('Bad URL\n')
sys.exit (-2)
print '<?xml version="1.0" encoding="utf-8" ?>\n' '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n' ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n' ' xmlns:admin="http://webns.net/mvcb/"\n' ' xmlns:content="http://purl.org/rss/1.0/modules/content/"\n' ' xmlns:cc="http://web.resource.org/cc/"\n' ' xmlns="http://purl.org/rss/1.0/">\n' ' <channel rdf:about="'+d.feed.title_detail.base+'">\n' ' <title>'+d.feed.title+'</title>\n' ' <link>'+d.feed.link+'</link>\n' ' <description>'+d.feed.subtitle+'</description>\n' ' <dc:language>'+d.feed.title_detail.language+'</dc:language>\n' ' <dc:creator>'+d.entries[0].author+'</dc:creator>\n' ' <dc:date>'+d.feed.modified+'</dc:date>\n' ' <admin:generatorAgent rdf:resource="'+d.feed.generator_detail.href+'"/>\n' ' <items>\n' ' <rdf:Seq>\n'
for entry in d.entries:
print ' <rdf:li rdf:resource="'+entry.link+'"/>\n'
print ' </rdf:Seq>\n' ' </items>\n' ' </channel>\n'
for entry in d.entries:
print ' <item rdf:about="'+entry.link+'">\n' ' <title>'+entry.title+'</title>\n' ' <link>'+entry.link+'</link>\n' ' <description><![CDATA['+entry.content[0].value+']]></description>\n' ' <dc:date>'+entry.updated+'</dc:date>\n' ' </item>\n'
print '</rdf:RDF>\n'

Now when I add an atom feed into snownews I apply this filter and that's all folks ;)

2006-05-17

My current apps

Hi,

I am gonna show you my more commons applications. This will include: desktop environment, email client, chat, music, browser, news aggregator, file manager and other thingies.

Desktop Environment


It is Xfce! No you didn't guess it? even with all my Xfce related links? :-) Well I like it. I am currently using the svn version which is gonna be the next stable release, version 4.4. This also means that the svn won't see new features which could broke the code before the release.

See here how to install from svn or get the 4.4Beta1. The Beta 1 will also be available in Debian/Sid as soon as some libs get out from the NEW state.

I have a moveable panel with worspace margins. If I am missing a workspace I just type ALT+Insert. At the opposite I type ALT+Delete ;) There are nice plugins for the panel. I am using the window list plugin to not feed my display with a large panel and buttons of applications on it. I have a clipboard manager for the default and primary clipboard. There is a box execution which does autocompletion and history: verve. There is also a systray box and clock plugins. Furthermore there are monitoring plugins for network (netload), system (systemload and cpugraph) and sound (xfce4-mixer).

Email Client


I am completely amazed with Sylpheed-Claws 2.2. It does the GNUPG signatures and encryptions. It supports filtering and, something new I learned from it, treatments on folders when you enter them, for instance it is very useful to move old emails into archives. It has a systray icon and I have setup a `playsound new_mail.ogg` when I get new emails. You can read the different parts (mime types) of an email just by clicking on buttons on the side (useful for HTML docs or attached patches). I like it, actually it is ass-kicking!

Chat (IRC, Jabber)


irssi and Gajim are my all and one at the moment.

irssi always fits into a screen, and if it is not running, this is my command line: screen -S irssi irssi, and next I will be able to detach, attach, reattach, multiple attach it in any Terminal I want. Recently I received a nice screenrc from omp. With this configuration I am able to see the numbers with names of the windows at the bottom (this rocks!). In irssi you can easily add a server or a channel to auto join, an alias or set the layout. Just type /help for this commands, or better, just type /help ;) My preferred theme is madcow.

Gajim is a very good client for Jabber. It supports avatars and tabbed window chat (you can detach them of course). The file transfer works fine. Its interface is fancy and simple. For creating or adding accounts it has a three steps wizard. Oh, and maybe the most interesting aspect, it uses dbus and has a gajim-remote python script so you can command it from your own scripts.

Web Browser


As a browser of today which supports CSS, HTML, Javascript, DOM, and all the latest stuff for the web, I use Firefox. It has some very useful extensions: CustomizeGoogle, Adblock, Gmail Notifier, NoScript, Add N Edit Cookies, Web Developer, Live HTTP Headers, del.icio.us, Parent folder.

Another nice graphic browser is the one from Gnome: Epiphany. Its engine is also Gecko. However it is slow in rendering big documents (like 20 pages).

Next comes Dillo. It is my first choice because it shows up very quickly and doesn't support CSS, so you just have to scroll to the text and read it black on white :) It supports bookmarks in a nice way.

Then comes the text browsers: links (it has a graphic mode in X11 as in frame-buffer) and lynx. links supports Javascript while lynx doesn't... that's a point enough for me to have both :o)

News Aggregator


Liferea is a nice shot. You can add virtual folders to match strings on the whole news. It is very nifty to filter out topics you want to read ;)

snownews is an alternative for console-addicted.

File Manager


I'm using Thunar for a while now. It is really nice for managing images and launching videos. I have some customized actions for file types and directories (i.e. for music folders, images, opening a Terminal or archives).

It supports: mouse gesture, thumbnails, multiple views (Icon, Tree and Compact), bulk renamer for simply rename multiple files, file alteration monitor (Gamin or FAM), plugins, ...

And everything goes faster ;)

Music


The last month I tried Rhythmbox from Gnome and I didn't ended up with it. I just don't remember exactly why but I think it was because of its interface and it was the first time I saw a player without "Stop" (you will understand later ;).

Next I tried Musid Player Daemon (MPD in short). It is very attractive. It is launched as a service at boot time just after I mount my LVM devices, and starts playing. YAY, you don't need Xorg! There are many clients for MPD. For example mpc is a command line tool, fantastic for scripts. Then there is ncmpc which is a ncurses interface to control your music. Next there is gmpc, it is a simple GTK+ interface with plugins like covers, lyrics or OSD. Finally you can have web based clients. I tried ajaxmp for a better experience. It supports drag'n'drop and all possible MPD stuff. A must when you are not working on your usual desktop environment :)

As of today, I'm using Quod Libet for less than a week ago. I tried it and directly understood that this is the Multimedia Music Media Player For Lot Of Music player I want :) I didn't use all of its possibilities and features yet but it manages a collection, just like Rhythmbox and MPD, shows covers, fetches lyrics, make notations, looks pretty good, has no "Stop" button (I'm used to it now:), does cool things like playing random albums, has a lot of views and has a lot of plugins. It is promising :) Its OSD just rocks bottom. I can flood IRC with `quodlibet --print-playing` . It is definitely the coolest music player I ever had.

Id3 tags can be edited rather with EasyTAG (MP3, MP2, MP4/AAC, FLAC, Ogg Vorbis, MusePack and Monkey's Audio files), Quod Libet (Ex Falso) or a plugin for Thunar.

For console-addicted I can list: mpg123, ogg123 and mp3blaster (OSS driver) which provides a nice id3 tag viewer tool: mp3tag. playsound from the libsdl-sound package is also fine.

Thingies (rather unclassed)


Here I am gonna list some useful tools very quickly just to name them and to conclude with a nice paragraph ;)

Evince and xpdf are cool pdf viewers. Stardict is a cool dictionnary. GNU people are cool, don't hit them with stupid questions, RTFM instead. A hacked Terminal is worth a try, personnaly I changed the alpha color value from #aaa to #ccc because this way I can read something. XMoto is a funny and simple game but Noiz2sa is a must game. lftp is a good ftp client which looks like a shell. gcolor2 is a cool color selector. mplayer, VLC and Totem are good video players. Vim is useful. K3B, Gnomebaker and Xfburn can all burn CDs and DVDs. Pan and tin are for USENET. The GIMP can do cool stuff while GQview is a nice image explorer. Devil's Pie is a good window matching utility. Inkscape can do some complete vector graphics. MOC is yet another good audio player for the console. htop is a nice process explorer.

In conclusion


As you can read I cover most of all my needs with Xfce4.4. I don't wan't a desktop dependant environment especially like GNOME or KDE. Both are making good stuff but I find them quite heavy.
If you are looking for a more lightweight environment I suggest you Openbox ;)

2006-05-09

Be welcome on my blog.

I am trying to get more and more involved in Information Technologies especially around Unix systems. I don't care about languages like C#, .NET, ASP or Basic (brrr) because they are not free and therefore it can't be good for information. I do care about Python, PHP, Shell scripts, a bit of Perl and a bit Java. I know some HTML, CSS, Javascript and SQL. I like very much programming in C where GTK+ is a fine toolkit.

When I find something new and I enjoy it, I just open my blog and share it ;)

You should also have a look at my old blog.

Cheers,
Mike.