2010-04-14 22:10

Bookmarklets are links containing Javascript code. They are useful when you save them in your bookmarks, in order to achieve some processing on the current page displayed in your browser.

It is possible to create bookmarklets authenticating you on a site with a login form. Note that it requires storing your login and passwordin the bookmarklet source code.

Login bookmarklet example

The bookmarklet code on several lines:

javascript:
document.body.appendChild(document.createElement('div')).innerHTML='
<form name="BletForm" method="POST action="http://www.woozweb.com/loginctrl">
<input type="hidden" name="login" value="MONLOGIN" />
<input type="hidden" name="pass" value="MONPASS" />
</form>';
document.forms['BletForm'].submit();

This code generates a POST HTTP request with two parameters, from your bookmarks. Writing this kind of code is easy for Web developpers, but hard for regular users.

So I wrote a bookmarklet that itself can generate login form bookmarklets, easily.

It’s very simple:

  1. Drag the generator bookmarklet in your bookmarks:
    generator
  2. Open a web page with a login form.
  3. Click on the generator in your bookmarks: a message appears next to the form.
  4. Fill in the login form.
  5. Click on the generation link: the bookmarklet appears.
  6. Drag the generated bookmarklet in your bookmarks.
  7. Finally, test your automatic login bookmarklet!

The generator bookmarklet even works with the login screen of my bank account. Obviously, your login information is stored directly in the bookmark, which is not very secure…

Notes:

  • Only tested with Firefox. Some work to make it compatible with Safari and IE.
  • Find a way to use Firefox password storage to retrieve the password.
  • If the bookmarklet doesn’t work for you, give me some feedback.

Links:

2010-04-14 22:10 · Tags: , ,
2010-03-09 22:11

Here is a small C program I wrote some years ago: Clictap. It’s very convenient and I’m still using it to watch my movies.

It makes use of Xlib and Xtest libraries to replace your mouse buttons by keyboard keys.

I made a small Debian package a few days ago:

clictap_0.6-1_i386.deb

soon included in the official repositories ?

Configuration file example including profiles for totem, xmms, rhythmbox and mplayer:

# ClicTap configuration file
# You can copy this example to ~/.clictap.conf

# When this key is pressed, Clictap will ungrab your mouse and quit
# Examples :
# quit_key q
# quit_key ctrl+q
quit_key q

# Profile used by default
default_profile mplayer

# List of profiles
# For each profile, a set of buttons to keys translations is given,
# each translation on a separate line.
# For a translation, the first field is the set of buttons,
# the second is the set of keys.
# Buttons are specified by their numbers.
# Keys are specified by their KeySym (Key Symbols).
# To know the button numbers and KeySyms, use the xev program to test X events.
# Example :
#
# profile foo
# 	1   a
# 	2   b+c
# 	3+1 space
# 	3+2 Control_L+d

profile totem
	1 b
	2 p
	3 n
	4 Up
	5 Down

profile xmms
	1 w
	2 c
	3 b
	4 Up
	5 Down

profile rhythmbox
	1 Alt_L+Left
	2 Control_L+space
	3 Alt_L+Right
	4 Control_L+Up
	5 Control_L+Down

profile mplayer
	1 Left
	2 space
	3 Right
	4 asterisk
	5 KP_Divide

profile mplayersub
	1 x
	2 space
	3 z
	4 asterisk
	5 KP_Divide

profile test
	1 XF86AudioLowerVolume
	2 space
	3 z
	4 asterisk
	5 KP_Divide
2010-03-09 22:11 · Tags: , , , ,
2010-03-02 22:31

A music group from Québec: Camusiciel. A friend of mine plays in it.

Here is their first video clip:

The video is made from a set of photos shooted from a fixed camera. Imagine the number of photos… and the work of assembly!

In the film, you can see me putting some glasses at the beginning :)

Visit their website: www.camusiciel.ca

2010-03-02 22:31 · Tags: ,
2010-02-10 19:38

The well known way to remove a service from system boot under Debian / Ubuntu, without removing the package:

update-rc.d -f mysql remove

This command removes all /etc/rc*/*mysql* symbolic links. At next boot, the service is not started.

Problem: when you update the mysql package (aptitude update), symlinks are created again.

Solution: in the last update-rc.d versions, there are disable / enable commands:

update-rc.d mysql disable

Useful if like me you only start apache or mysql some times for Web development. Also useful if you share files with Samba and only want to start the daemon occasionaly.

Note: update-rc.d --help tells us that The disable|enable API is not stable and might change in the future.

References:

2010-02-10 19:38 · Tags: ,
2010-01-26 23:51

Under Ubuntu, or any distribution using Gnome, you can do almost anything without using the command line.

To configure some things, you still have to edit a configuration file. To configure your desktop, a lot of online documentation still requires you to to edit /etc config files.

To help non linux experts, you can try the nautilus-gksu package. It permits you to edit any file as administrator with a simple right-click on the file.

Personnaly, I prefer launching Nautilus as root, as it allows more than simple file edition power (permission change, deleting…).

I create a launcher for this task, a bit like the Administrator Terminal in Applications > System Tools:

  1. Right-click on the panel > Add to panel, Custom Application Launcher.
  2. Name: Nautilus superuser
  3. Command: gksu nautilus

Et voila.

2010-01-26 23:51 · Tags: , ,
2010-01-26 23:09

In some modern distributions like Ubuntu, there are preconfigured user directories like Desktop, Download, Documents, Images, Music, Vidéos.

ubuntu_user_dirs.png

You can remove some of the directories you don’t use, or rename some of them.

If you change their name, you can set their new place in your ~/.config/user-dirs.dirs file:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Bureau"
XDG_DOWNLOAD_DIR="$HOME/telech"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/public"
XDG_DOCUMENTS_DIR="$HOME/docs"
XDG_MUSIC_DIR="$HOME/zic"
XDG_PICTURES_DIR="$HOME/images"
XDG_VIDEOS_DIR="$HOME/cine"

Then restarting Nautilus should be sufficient. Otherwise restart your Gnome session.

References:

2010-01-26 23:09 · Tags: , ,
2010-01-10 23:39

When Ubuntu starts, the USplash screen hides you the Linux boot and commands. If you’re a geek spirit, you’ll prefer those “cabalistic writings”. Here is how to disable USplash without removing the usplash and usplash-theme-ubuntu packages (because package ubuntu-desktop depends on them).

usplash_karmic.png

Disable USplash, then rebuild initramfs:

sudo vi /usr/share/initramfs-tools/conf-hooks.d/usplash
USPLASH=n
sudo update-initramfs -u

Links:

See also:

2010-01-10 23:39 · Tags: , ,
2010-01-10 22:45

XSplash is new in Ubuntu Karmic. If you don’t like this ugly screen like me, here is how to disable it.

xsplash_karmic.png

The dpkg -l | grep xsplash command tells you that two package are responsible for this horrible screen: xsplash and ubuntu-xsplash-artwork. To remove them, you also have to remove the ubuntu-desktop package. That is not recommended if you don’t want to miss something in the next Ubuntu upgrade.

Here it is:

sudo rm /etc/dbus-1/system.d/xsplash.conf
sudo touch /etc/dbus-1/system.d/xsplash.conf

We remove the file and create an empty one. Why ? Because if we just delete the file it will be created back again during the next update. If you create an empty file in place, the next update will ask you what to do with the file.

Et voila, restart and enjoy the “visual peace”.

Link:

See also:

2010-01-10 22:45 · Tags: , ,
2010-01-09 23:09

Under Arch Linux, your network cards are sometimes named differently between two reboot. Configuring your network connection is hard if you don’t know if you card will be called eth0 or eth1.

A file /etc/udev/rules.d/75-persistent-net-generator.rules.optional can be used to tell udev to generate persistent network rules.

It’s very simple:

mv /etc/udev/rules.d/75-persistent-net-generator.rules.optional /etc/udev/rules.d/75-persistent-net-generator.rules

Reboot your system. A /etc/udev/rules.d/70-persistent-net.rules file has been generated. Now you can disable the generator:

mv /etc/udev/rules.d/75-persistent-net-generator.rules /etc/udev/rules.d/75-persistent-net-generator.rules.optional

Link:

2010-01-09 23:09 · Tags: , ,
2010-01-06 23:41

Before doing anything: backup your sensible data!

To extend a partition and it’s filesystem, you have to:

  1. Extend the partition
  2. Extend the filesystem

To shrink a partition and it’s filesystem, you have to:

  1. Shrink the filesystem
  2. Shrink the partition

For an ext3 partition, simply use parted:

parted /dev/sdx
print
resize N

Parted doesn’t support ext4 (yet?). For an ext4 partition or if parted refuses to resize your ext3 partition (Error: File system has an incompatible feature enabled.), use resize2fs:

To extend:

cfdisk /dev/sdx
# delete the partition and create it again with the desired size
resize2fs /dev/sdxY

Without giving any size, resize2fs extends the filesystem to the partition’s size.

To shrink, it’s almost as simple:

# example if you want a 10G partition
# resize filesystem with a size smaller than the desired size
resize2fs /dev/sdxY 9G
cfdisk /dev/sdx
# delete the partition and create it again with the desired size
# (a little bigger than the filesystem!!)
# then launch resize2fs again
resize2fs /dev/sdxY

Doing so we get the good partition size without loosing any space.

Notes:

  • If your partition is over LVM, you can use the lvresize or lvextend or lvreduce commands to resize the partition, instead of deleting/creating the partition with cfdisk.
  • The method also works for other filesystems like NTFS. For NTFS, you will use the ntfsresize command, or parted if it works.

Links :

2010-01-06 23:41 · Tags: , , , , , , , ,