a3nm's blog

A list of French words with no rhymes

— updated

English explanations

In this post, I present a list of French words which have no satisfactory rhyme (aka. orphan rhymes). I computed it from the Lexique database and curated it manually to fix errors and omissions in the DB and exclude some words (and added some from the French Wikipedia).

Of course, this list is not definite, since there is no clear definition of the boundaries of the French language, and no clear definition of what constitutes an acceptable rhyme. For this list, I excluded exotic-sounding foreign borrowings and slang terms, and required rhymes to match up to the last vowel phoneme (exactly, including the "brin"/"brun" distinction), to respect rhyme gender, and forbid rhymes between derived terms (ie. terms with a common etymological suffix, conjugations of the same verb, singular and plural forms...).

I did not expect this list to be so long, and to include so many reasonably common terms, but here you are... Preparing the list was a very nice occasion to learn about a lot of weird-sounding rare words; I provide links to the French Wiktionary if you want to learn more about some words (but I didn't check if all those pages actually exist). Thanks to Ted for his help in cleaning up the list. See also my list of non-homophonous homographs in French and my list of ambiguous verbal forms in French.

Added "film" (thanks to Hervé Bercegol).

Added "ogre".

Removed "caroube" following comment by cl-r.

Explications en français

Dans ce post, je présente une liste de mots français qui n'ont pas de rime satisfaisante (alias des rimes orphelines). Je l'ai calculée à partir de la base de données Lexique et l'ai ajustée à la main pour corriger des erreurs et des omissions, et pour exclure certains mots (et en ajouter à partir de Wikipédia).

Évidemment, cette liste n'est pas la seule possible, parce qu'il n'y a pas de définition claire des limites de la langue française, et pas de définition claire de ce qui constitue une rime acceptable. Pour cette liste, j'ai exclu certains emprunts étrangers trop exotiques et certains mots familiers, et j'ai exigé que les rimes correspondent jusqu'au dernier phonème vocalique (en respectant notamment la distinction "brin"/"brun"), qu'elles respectent le genre des rimes, et qu'elles ne soient pas faites entre des termes dérivés (par exemple des termes avec un suffixe étymologique commun, des conjugaisons du même verbe, un même terme au singulier et au pluriel...).

Je ne pensais pas que cette liste serait si longue, et qu'elle inclurait autant de termes raisonnablement communs, mais comme vous pouvez le voir... Préparer cette liste a été une occasion plaisante d'apprendre l'existence de termes rares aux sonorités étranges ; je fournis des liens vers le Wiktionnaire pour vous aider à chercher (mais je n'ai pas vérifié que les pages existent vraiment). Merci à Ted qui m'a aidé à nettoyer la liste. Voir aussi ma liste d'homographes non-homophones en français (en anglais) et ma liste de formes verbales ambiguës en français.

Ajout de "film" (merci à Hervé Bercegol).

Ajout de "ogre".

Suppression de "caroube" suivant un commentaire de cl-r.

The list / la liste

More fnacbook hacking

— updated

In this followup to my previous post about hacking the Kobo, I present a few other tips.

Reindexing the collection

It turns out that you can reindex the collection on the device without actually pluging it in a computer. This is very useful if you add or remove files to the device directly (using sftp, for instance), though you do not need it if you are just replacing existing files. The idea is that nickel uses the FIFO /tmp/nickel-hardware-status to get notified about events: if you write usb plug add or usb plug remove to this file, it will act as if the Kobo had been connected or disconnected to the computer.

Hence, you can create a file reindex.sh containing:

echo usb plug add >> /tmp/nickel-hardware-status \
  && sleep 10 \
  && echo usb plug remove

Make it executable and run it with nohup ./reindex.sh. nickel will present a dialog, quickly select "connect", and wait for the fake disconnection and reindexing to take place. Unfortunately, this will disconnect the Wi-Fi (hence the nohup business).

[This one was sent to me by Andreas Heider. Thanks a lot for suggesting this!] I also noticed that, when you download a file through the built-in web-browser, it will get indexed. It could be sensible to run a minimalistic web-server on the device to serve files already stored on the device to make the device index them. Maybe I'll investigate this later.

Automatic reverse ssh

You might want to connect to the device easily without having to find out its IP or worrying about NATs. The right tool for this problem is openvpn, but it has a lot of dependencies and isn't exactly light. A satisfactory (and probably simpler) alternative is to get the device to reverse ssh to a trusted server (with key-based authentication) when it connects to the Internet, so that you can always use this to get a shell.

I already mentioned how to get dropbear running on the device. To get reverse ssh working, it turns out that you have to add busybox ifconfig lo up to the /etc/init.d/rcS file because it isn't done by default. Then, generate a key using dropbearkey -f /root/.ssh/id_rsa -t rsa and copy the fingerprint returned by the command to your authorized_keys file on the trusted server. Obviously, if you worry that unauthorized people might have access to your device, you should use an account with very little permissions.

Now, once you have checked that dbclient -i /root/.ssh/id_rsa USER@SERVER works without asking for a password, you can add the following reverse ssh command at the end of the renew|bound) section of file /etc/udhcpc.d/default.script (note the unsafe "-y" to avoid unknown host key issues, and adapt if you don't like this):

dbclient -y -i /root/.ssh/id_rsa -R 4080:127.0.0.1:22 USER@SERVER < dev/ptmx &

Now, when obtaining or renewing a DHCP lease, the device should run the reverse ssh. I have found this to be pretty fragile when testing, for unknown reasons: workarounds you might want to try are using the IP address of SERVER directly (in case DNS resolution is not working properly yet) or moving the command to a separate script which sleeps for a few seconds before running the command.

Leaving the Wi-Fi active

I was complaining in my previous post about the Wi-Fi getting disabled after a few minutes. According to the (very insightful) guide Hacking the Kobo Touch for Dummies, the responsible for this is nickel, and, indeed, just running killall nickel will fix the problem. Obviously, without nickel running, there is little you can do with the device except from using ssh. When you're done, the /etc/init.d/rcS file suggests that you can get nickel back by issuing something like:

INTERFACE=wlan0
WIFI_MODULE=ar6000
if [ $PLATFORM == ntx508 ]; then
  INTERFACE=eth0
  WIFI_MODULE=dhd
fi

export INTERFACE
export WIFI_MODULE

export QWS_MOUSE_PROTO="tslib_nocal:/dev/input/event1"
export QWS_KEYBOARD=imx508kbd:/dev/input/event0
export QWS_DISPLAY=Transformed:imx508:Rot90
export NICKEL_HOME=/mnt/onboard/.kobo
export LD_LIBRARY_PATH=/usr/local/Kobo
export WIFI_MODULE_PATH=/drivers/$PLATFORM/wifi/$WIFI_MODULE.ko
export LANG=en_US.UTF-8
export UBOOT_MMC=/etc/u-boot/$PLATFORM/u-boot.mmc
export UBOOT_RECOVERY=/etc/u-boot/$PLATFORM/u-boot.recovery

/usr/local/Kobo/nickel -qws

Trouble is, this does not seem to work perfectly (the new nickel instance is a bit broken, especially with regards to Wi-Fi). I would need to investigate more. Of course, to fix things for real, you can always just reboot the device.

Displaying stuff on the Kobo from the shell

People have already figured out how to display stuff on the Kobo's screen from the shell. It's pretty minimalistic (only images in a weird format). To spare a click, here is how you do it:

ffmpeg -i $INPUT.png -vf transpose=2 -f rawvideo
    -pix_fmt rgb565 -s 600x800 -y $OUTPUT.raw
cat $OUTPUT.raw | ssh DEVICE /usr/local/Kobo/pickel showpic

Of course, this means that you can replace the images in /etc/images and /usr/local/Kobo/slideshow by other images. Disappointingly, though, the interesting images (the "powered off" and "sleeping" logos) don't seem to be there and seem to be displayed in another way. The most interesting thing you can customize is the boot animation (/etc/images/on-*.raw.gz).

Retrieving touchscreen events from the device

The (very insightful) guide Hacking the Kobo Touch for Dummies also explains how to recover the touchscreen input events from the device:

evtest /dev/input/event1

There is a lot you can do by forwarding these events to your computer and interpreting them creatively (a custom remote control, for instance). As always, buffering issues are a problem when trying to retrieve the events synchronously. Here is a possible way to retrieve the useful info, where DEVICE is where you can reach the device:

cat <(echo 'evtest /dev/input/event1;') - |
  socat EXEC:'ssh DEVICE',pty,ctty,echo=0 STDIO |
  sed -u 's/$/\n/' |
  stdbuf -i0 -o0 -e0 cut -d ' ' -f 9,11,13

In case you're wondering, the sed command is because the newline at the end of the last event is outputted when the next one happens, which isn't really convenient if you want to pipe the data to something.

Here is a small Python program to run on your computer which accepts this input and will draw what you do on your touchscreen:

import pygame
import pygame.draw
import sys

pygame.init()

def line(x1, y1, x2, y2, r=255, g=255, b=255):
  global window
  pygame.draw.aaline(window, (r, g, b), (x1, y1), (x2, y2))

window = pygame.display.set_mode((600, 800))

pre = None

while True:
  l = sys.stdin.readline()
  if not l:
    break
  l = l.rstrip().split(' ')[0:3]
  if len(l) != 3 or '' in l:
    continue
  print l
  if pre:
    line(600-int(pre[1]), int(pre[0]), 600-int(l[1]), int(l[0]))
  if l[2] != '0':
    pre = l
  else:
    pre = None
  pygame.display.flip()

Obviously, you should try to minimize the network latency if you want this to be pleasant.

Use, mention, and titles

— updated

In this post, I present the use-mention distinction. Consider the following sentences:

  • John told me a few words.
  • John told me "a few words".

Those sentences don't mean the same thing. The first one means that John told me a few words, without specifying what those words were. The second means that John told me literaly "a few words", that is, he told me exactly three words, which were "a", "few", and "words".

The distinction seems trivial in this example, but it is seldom fully respected. Consider for instance:

  • There's a difference between him and her.
  • There's a difference between "him" and "her".

The first sentence refers to two people, one male and one female, and says that they are different. The second says that the words "him" and "her" are different. This example is clear, but consider:

  • Notice that affect is always a verb.
  • Notice that "affect" is always a verb.

People will often write the first sentence without noticing that it is not what they mean, and that it is not even gramatically correct. Indeed, what about:

  • Notice that that is never a verb.
  • Notice that "that" is never a verb.

Clearly, we need the quotation marks.

Worse still, there are names and titles.

  • I love War and Peace. (referring to the book by Tolstoy)
  • I love war and peace. (referring to war and peace in general)

There are often typographical and case distinctions to disambiguate, but they are not always obvious:

  • I love adventure. (referring to the classical video game called "adventure")
  • I love adventure. (referring to adventure in general)

Here is a final example:

  • I read a book yesterday. (ie. I read some book)
  • I read "a book" yesterday. (ie. I read the literal words "a book")
  • I read A Book yesterday. (ie. I read this book — not an endorsement, I don't know it, but the title is fun)

The fact that humans are almost never confused by missing quotation marks or missing italics is pretty surprising when you're used to working with computers.

drime -- a better French rhyme dictionary

— updated

English version

Version française ci-dessous.

When I write poetry in French, I find rhyme dictionaries valuable. Unfortunately, I couldn't find a satisfactory one, so I wrote my own French rhyme dictionary.

Its nice features are support of rhyme gender (a rhyme constraint which is often forgotten these days), filtering on the number of syllables so you can easily complete your verse, good results and a nice ordering. It suits my needs, more or less, so maybe it'll suit yours; if it doesn't, feedback is always welcome.

If you want to run it on your server or on your machine (with a CLI interface), you can grab the sources or have a look at the README.

Version française

English version above.

Quand j'écris de la poésie, j'aime bien utiliser un dictionnaire de rimes. Malheureusement, je n'en ai pas trouvé qui me satisfasse, donc j'ai fait mon propre dictionnaire de rimes françaises.

Il comprend des fonctionnalités telles que le respect du genre des rimes (contrainte que les gens ont tendance à oublier de nos jours), le filtrage sur le nombre de syllabes pour compléter un vers, des résultats pas trop mauvais et un ordre de tri pas trop absurde. Il répond plus ou moins à mes besoins, peut-être qu'il peut vous être utile. Si quelque chose vous déplaît, les commentaires sont bienvenus.

Si vous voulez le faire tourner sur votre serveur ou sur votre machine avec une interface en ligne de commande, vous pouvez récupérer le code source ou jeter un œil au README.

Hacking the fnacbook (aka. Kobo by Fnac)

— updated

I just got a Fnacbook for Christmas. Of course, I have no intention to use this device to buy DRM-ed files, or sync it to the cloud, or use any of the invasive "social" features provided. In this post, I give some information to understand what the beast does, how to get a shell, and how to prevent it from accessing the manufacturer's website using /etc/hosts.

Of course, though this information seems correct as of this writing, it might become outdated as new versions of the firmware get released and other versions of the device come out. Be careful, and don't blame me if something goes wrong.

See also my followup post about the Kobo Touch and Kobo Glo.

What's in the box?

There is little documentation (and no useful documentation) provided with the device in the Fnac packaging, but you can find out from the serial number that the device is a Kobo Touch N905. It's pretty hard not to get confused by people writing about different Kobo devices. The Wikipedia page about the Kobo eReader gives an overview of the existing devices.

Mounting the device

The device can just be mounted as an UMS drive on a Linux computer. Beware, however: if the device appears as /dev/sdb, you need to mount /dev/sdb directly, not /dev/sdb1. Indeed, running fdisk -l /dev/sdb will not show any partitions. This is normal, and confused me for some time.

Registration, and how to circumvent it

When powering up the device, it will first ask you to pick a language, and will then ask you to install the free desktop application on your computer and synchronize with it. Of course, this application is not free as in freedom, and getting it to run under Linux seems nontrivial. You can skip the activation step, but some features (like activating Wi-fi) will not be available until it has been completed. Or rather, until the device thinks it has been completed.

Fortunately, the device is just naively checking for a record in an sqlite database that is available when you mount it on your computer, so this is easy to fake. Assuming that you mounted the device as /mnt/kobo with suitable permissions, just run:

echo "insert into user values('foo', 'foo', 'foo', 'foo', 'foo');" | sqlite3 /mnt/kobo/.kobo/KoboReader.sqlite

Ethan S. points out that the schema of this SQL table has changed on more recent Kobo versions, so you may need to adjust these instructions to the format used by your Kobo. You can also refer to this thread for more information.

When you unmount the device and unplug it and tap the sync icon, you should now be able to use Wi-fi.

Reading life, and why you might want to disable it

The settings page mentions a feature called "Reading Life" which is presented as something which "allows you to track your reading activity and win awards from Kobo". Reading the presentation page, however, I get the impression that it is some "social" feature which will also allow Kobo (and maybe their partners) to track your reading activity. I don't know the exact scope of this, but if you're like me, you'll probably want to disable this right away. This can be done from the settings menu. An alternative, more radical method is presented in the next sections.

it seems that the device is also sending tracking information via Google Analytics, see this thread

Updating the firmware

When the device gets an Internet connection, it will silently connect to mobile.kobobooks.com and, among other things, request a firmware update. If one is available, it will download it automatically and prompt you to install it. I found some information about the details of this exchange, but it is outdated. Fortunately, someone already did the sniffing and we have the URL of firmware 1.9.16 which is the most recent as of this writing. You can download it manually, examine it and install it by uncompressing the zip archive in the .kobo folder (source).

Rolling your own update to get a shell

Retrieving the update manually makes it possible to examine what it contains. In the zip file, you can see that the device is using u-boot, and you can see a KoboRoot.tgz file. As it turns out, if such a file is present in the .kobo folder, it will just get decompressed to /. This means that we can alter the system to suit our needs.

Actually, someone already documented the process to get telnetd and ftpd running, though the instructions need to be adjusted for the firmware you have. For version 1.9.16, you will need to:

  • Create /etc/inetd.conf as documented in the old instructions.
  • Prepare /etc/init.d/rcS by retrieving it from the KoboRoot.tgz in the original update and adding the following lines at the end (from the old instructions and updated info):
    mkdir -p /dev/pts
    mount -t devpts devpts /dev/pts
    /usr/sbin/inetd /etc/inetd.conf &
    
  • Ensure that rcS is executable.

Now, zip the resulting etc folder in a file named KoboRoot.tgz, put it on the device like regular firmware, unplug, and the device will install it and reboot. Now, if everything worked well, you can connect to a network and have telnet and ftp access as root (with no password). Of course, this is unsecure, and you should setup a password (just run busybox passwd from the root shell).

Running dropbear

Running dropbear on the device provides an ssh client and an ssh server, which can supersede both ftp and telnet, is more secure, and can be used for passwordless authentication. This comment indicates how to do it, except that you will need to set root's home to /root in /etc/passwd (and use /root/.ssh as the ssh configuration directory) to get key authentication working (dropbear will complain about permissions not being right otherwise).

(In case the comment above disappears, the crucial information is that you should use the "diablo Extras free armel" version of dropbear from Maemo. more information about dropbear and reverse ssh on my followup post)

Note that scp access (or ftp) allows you to upload books to your device over Wi-fi. However, it will not trigger the content indexing phase that the device normally performs, which is why it will not see new books or will crash when trying to access books which no longer exist. The indexing step is triggered by plugging the device to a computer and unplugging (even without mounting it), and I haven't found any way to trigger it from the shell yet. :-( actually, there is one, see my followup post

Another problem is that the device will apparently turn off the Wi-fi connection automatically after some time to save battery, which is annoying when using a shell. I haven't found how to disable this yet. a crude one is suggested in my followup post

Factory reset

If you keep the home button pressed while booting the device, it will immediately and without confirmation perform a factory reset. I am not sure yet about how this reset is performed, but it seems to be pretty low-level, as it seems to restore the root filesystem in the factory state. I confess that I messed up at some point and flashed something which prevented the device from booting, but the factory reset was able to save me. I guess it is hard to brick the device unless you start messing with u-boot, though this is just a guess.

Preventing the device from phoning home

It is likely that any updates to the root fs will overwrite /etc/init.d/rcS and require you to perform part of this setup again. Or maybe it will change the way updates are installed and break this setup. Since those updates get installed automatically whenever an Internet connection is enabled on the device, this is a problem.

I don't know of any way to make updates opt-in. The only way I found is to use the /etc/hosts to block the device from contacting its parent site. This also has the benefit of blocking any tracking like Reading Life. To do this, add the following to /etc/hosts:

0.0.0.0 kobobooks.com mobile.kobobooks.com www.kobobooks.com dev.kobobooks.com
0.0.0.0 partner.dev.kobobooks.com ecimages.kobobooks.com images.kobobooks.com
0.0.0.0 www.google-analytics.com ssl.google-analytics.com google-analytics.com

added Google Analytics blocking as per this thread

To check that this works, just connect to a network and the device should give an error message "Network Error". Of course, the connection is perfectly functional, and the device is just complaining about not being able to reach its server. Note that you can replace 0.0.0.0 with the IP of a machine you control if you want to see what the device is sending and possibly forge replies. I haven't tried this yet.

This means that you will not automatically get the latest updates from Kobo, of course (which is the whole point). If an update is released, first review it to see what it does, and, if it doesn't do anything evil, download it and install it manually like explained above, after fixing the rcS file if necessary.

More info

If you really want to hack the reader, code is available. I also recommend the blog post series by Craig Ringer about the device.

I also recommend Hacking the Kobo Touch for Dummies, and my followup post about the Kobo.