Site perso : Emmanuel Branlard

Subsections

5. APPPLICATIONS


5.1 xrandr - arandr - Dynamic Multiple screens - xinerama

arandr is a graphical tool for xrandr
make a configuration and export it as a script.

x=`xrandr --query |grep 1920 |wc -l`;

5.2 Download google books

Greasemonkey script

This is the most powerful and stable way to download Google Book. You can easily download any book from books.google.com using Greasemonkey script. Just follow the simple steps below.

    This hack only works with firefox browser. Make sure you install firefox browser. 
    Now install Greasemonkey Script and then install Google book downloader userscript.
    Install Flashgot to firefox browser and restart your firefox browser.
    Search any book on books.google.com and you'll notice a download button at the sidebar as shown in screenshot.
    Click the download button to download the images of each. Select the pages you wish to download and then right click and select FlashGot Selection to download the selected pages.

%%%Script topdf
%!!! Might have problem with DirectClass PseudoClass etc,  use :
convert -page A4 -units PixelsPerInch -density 100 files*.png file.pdf
 
%!!! watch out for the files that are actually jpeg..

5.3 Thunderbird with calendar - Debian squeeze

icedove iceowl-extension

5.4 Vmail - gmail in vim

has recent dependencies

5.5 Vimperator - plugin to use vi in firefox

Basic motions from vim work : hjkl C-u C-d gg G C-b C-f C-e C-y
C-p C-n : go from one tab to the other

R : refresh
C: cancel
C-i : next
C-o : previous
d : delete tab

f or F : activate hints (numbered links)
F : will open in new tab

/ : search
n / N : go through search results

:o google search in current window
:t google search in new tab

5.6 Use Vi mode in bash

###Basics
In your .bashrc:
set -o vi

When typing a command, press ESC or CTRL-[ to go to vi mode

###For other terminal app
in the .inputrc file:

set editing-mode vi
set keymap vi
set convert-meta on

### Tips
Pressing # anywhere while in command mode will make the command a comment so that you can access it later

More:
http://www.jukie.net/bart/blog/20040326082602

man 3 readline

5.7 Playlists - Format - Conversions - Rhythmbox - Solving the problem of moved files

Formats: 
m3u : just a list of file location, Comments allowed with #
xfpf : a standard xml

Rhythmbox uses its own xml format for playlists.
Backup the playlist file : ~/.share/rhythmbox/playlists.xml

Thanks to python scripts found here http://ubuntuforums.org/showthread.php?t=1740610  you can convert rhythmbox xml file to a lists of m3u files

### Content of file rhythmboxplaylist2exaile:

#!/usr/bin/python
import os, string
marker = 0
marker2 = 0
orderlist = []
a = open( 'playlists.xml', 'r' )
if not os.path.exists("playlists"):
    os.makedirs("playlists")
os.chdir("playlists")
z = open( 'order_file', 'w' )
for line in a.xreadlines():
    if marker == 1:
        if line.find('<location>') != -1 and line.rfind('</location>') != -1:
            line = line[line.find('<location>')+10:]
            line = line[:line.find('</location>')]
            line = string.replace( line, '&amp;', '&' )
            if marker2 == 0:
                m = open( name+'.playlist', 'w' )
                z.write(name+'\n')
                marker2 = 1
            m.write(line+'\n')
        elif line.find('</playlist>') != -1:
            if marker2 == 0:
                continue
            m.write('EOF\n')
            m.write('random_enabled=B: False\n')
            m.write('random_mode=S: track\n')
            m.write('repeat_enabled=B: False\n')
            m.write('repeat_mode=S: playlist\n')
            m.write('dynamic_enabled=B: False\n')
            m.write('current_pos=I: -1\n')
            m.write('name=U: '+name+'\n')
            m.write('_is_custom=B: True\n')
            m.write('_needs_save=B: False\n')
            m.close()
            marker = 0
            marker2 = 0
    elif line.find('<playlist name="') != -1:
        if line.rfind('/>') == -1:
            line = line[line.find('<playlist name="')+16:]
            line = line[:line.find('"')]
            line = string.replace( line, '&amp;', '&' )
            name = line
            marker = 1
a.close()
z.write('EOF\n')
z.close()

5.8 Send email with attachment using the shell

#mail : simple emails
  mail -s "SUBJECT" to@serv.com < mail.txt

#mutt: emails with attachments
  echo "text" | mutt -a FILE -s SUBJECT -- to@serv.com

#mail+uencode : can send attachments

smtp or sendmail can be used to send mails.

An easy way consists in using an existing gmail account with smtp:
http://www.webupd8.org/2009/11/use-gmail-to-send-emails-from-terminal.php

See my script for sending external emails with Thunar.

Check /var/log/mail.log for errors

5.9 Mp3 tag from filenamejwith tagtool


5.10 Equalize MP3 using mp3 gain

find . - name '*.mp3' -exec mp3gain -r -k {} \; 

#But first, to hceck level without doing anything run:
find . - name '*.mp3' -exec mp3gain -s s {} \;

5.11 xls2csv

command among other tool from package "catdoc"

5.12 PDF password - password crack - pdfcrack - bypass - print by keeping CR

## Encrypting info
pdfinfo

## First try ghostscript(if read access but no modif)
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f crypted.pdf 

## For brute force cracking:
pdfcrack file.pdf -o
pdfcrack file.pdf -o -c `cat asciilist.txt`

5.13 R - Bypass user file

R --no-init-file

5.14 Iceweasel Backspace to go back one page

type about:config in the adress bar
filter for backspace
set the browser.backspace_action value to 0.

5.15 Configure pulseaudio for Debian - Iceweasel Soud problem

%%%% Curent config, that seem to work:
%%% For skype
pulse pulse pulse
%%% Pulse input device
Internal Audio Analog Stereo -> Analog Line In(set as fallback ???, don't put it to silence!!!!) 
(With headset Analog Microphone will work )

%%% /etc/pulse/daemon.conf
high-priority = yes
nice-level = -11

realtime-scheduling = yes
realtime-priority = 5

%%% Xfce application autostart
I desactivate pulseaudio
%%% Daemon started at boot (will warn because of per user settings) 
/etc/init.d/pulseaudio 
(update-rc.d pulseaudio defaults)

% The other option is not to start the daemon at boot, and use xfce autostart. 
% As it is, the sound will be such that skype goes cuts rhythmbox. It was not like this before..It's probably because now they go through /usr/lib/i386-linux-gnu/libsndfile.so

%%%# Introduction
The problem comes when several applications try to access the sound device directly.
There are two options :
- Use a mixer between the application and the hardware (pulseausio, or jack)
- Use the hardware mixer with an pplication like dmix provided alsa

Pulseaudio does this mixing job, and thus, allow playing of several applications at the same time.
Pulseaudio, starts by default, if called properlly by the application.

So let's try with pulseaudio which is now default in debian and ubuntu. Several people remove pulseaudio and don't have trouble...well, let's take the challenge.

# Firefox/Iceweasel/Flash player
vlc & rhythmbox together, no problem, they call pulseaudio.
The problem comes from iceweasel or maybe just the flashplugin which try to access the sound device directly.
If pulseaudio is called first, then iceweasel does not have access to the card  /dev/snd/*.
If iceweasel is called first and then pulseaudio, it's pulseaudio that can't access the card.

To see who is using what:
lsof -w | egrep 'snd|dsp'

Use this command extensively to debug: if you see that firefox-bin uses /dev/snd/* then, it will obviously not work. The only one that should use it is pulseaudio!

Below I give my solution, but I recently discovered this official page that could help (though it made things worse for me do to the gstreamer configuration) : http://pulseaudio.org/wiki/PerfectSetup 

%%% The solution that worked for me:
#(Step 0: As I was quite uncertain of my last install of flashplayer, I did a clean install, but this is not necessary
- Purged flashplugin-nonfree*
- Removed ~/.mozilla/plugins/flashplugin*.so  (not sure about the name anymore)
- locate flashplugin* to see if everuthing was purged correctly
- install flashplugin-nonfree and that's all
note for upgrade: sudo update-flashplugin-nonfree --install
)

#Step 1 : install all the pulseaudio stuff:
sudo aptitude install pulseaudio libao4  libpulse-mainloop-glib0 pulseaudio-module-jack pulseaudio-module-hal pulseaudio-module-x11 gstreamer0.10-pulseaudio pulseaudio-utils libasound2-plugins libpulse-browse0 pulseaudio-esound-compat libpulse0 

If you want to use bluetooth: pulseaudio-module-bluetooth 
If you want to use some visual interface stuff: pavumeter paprefs pavucontrol  
!!! PAVUCONTROL is really good. For instance, for recording audio card flux. Launch recording with audacity. then in pavucontrol /recording change internal to monitor in the audacity line.

#Step 2: Tell ALSA applications to use a "pulse" device.
Create/Edit file ~/.asoundrc (or /etc/asound.conf ) with the following content:

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

pcm.!default {
    type pulse
    # If defaults.namehint.showall is set to off in alsa.conf, then this is
    # necessary to make this pcm show up in the list returned by
    # snd_device_name_hint or aplay -L
    hint.description "Default Audio Device"
}

ctl.!default {
    type pulse
}
Note, I added the following for skype, but then I commented it, I'm not sure it was usefull: 
#pcm.dmixout {
#    type pulse
#}

This will create a pseudo-device called "pulse" that will be used by default by ALSA applications

#Step3: Make sure you have pcm(mixing) volume none zero
In terminal you can use alsamixer (I had to use the option -c 0) or aumixer, or probably the pulse audio commandline pacmd. 
or whatever volume mixer interface like xfce4-mixer, or the pulse audio one if you installed it.

#Step4: Test
Kill all applications using sound, including pulseaudio. The command lsof -w | egrep 'snd|dsp' should return nothing.
Do some testing. Hopefully you should be able to have youtube/vlc/rhythmbox working all together at the same time for a good cachophony.

%%% Wait, now I'm having a trouble, rhythmbox does not launch pulseaudio by itself
On some website they advise to configure gstreamer to set it to use pulsesink and pulsersrc. But this actually made things crash for me, rhythmbox or totem won't start pulse automatically. 
 
%What they suggests and that make things didn't work (maybe I'm missing a package or something): 
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc
gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink
%What worked for me is to set everything as auto
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink autoaudiosink
fconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc autoaudiosrc
gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink autoaudiosink

%%%
In the file /etc/iceweasel/iceweaselrc, replace the line ICEWEASEL_DSP="none" by ICEWEASEL_DSP="aoss"
aoss is a simple wrapper script which facilitates the use of the ALSA OSS compatibility library.
To install it :
root@localhost:~#apt-get install alsa-oss

Does it work??

%%% advanced setups
pacmd list-sinks

pacmd set-default-sink 1

5.16 Custom filetypes in geany

# to make it really custon, you need to comnpile one...
Otherwise use an existing parser(perl C, LaTeX) and customize it

# First step
launch Geany,Tool>>Configuration files>>filetype_extensions.conf
Add the line
Bib=*.bib;

and saved in ~/.config/geany/filetype_extensions.conf 

cp /usr/share/geany/filetypes.latex /home/manu/.config/geany/filetypes.bib.conf

5.17 Indexation - Search in pdf

#
swish++ appear as a good solution, it is configurable via a .conf file

instead of using a conf file, one can use do it manually
convert all pdf to txt via pdftotext
then index them with index++
then search with search++

#
Use tracker... it's easier and more complete
tracker-control -s    : To launch the indexing:
tracker-preferences   : for options
tracker-search-tool   : for graphical interface
tracker search bla    : command line search
tracker search -t bla : search in documents

5.18 OCR Text recognition and searchable PDF

Idea:
- splitting pdf
- converting to good image format (1bpp )
- use an OCR tool to create hOCR data (html OCR)
- use hocr2pdf to put the text data into the pdf
- combine the pdf (using pdfjoin from pdfjam)

%%% Step by step tools

# pdftk

# pdf2ppm 

# Creating hocr files from images
- tesseract (you need version 3 not 2.04 as in Debian see below)

- cuneiform
cuneiform -l language -f hocr -o output.hocr infile.ppm

# hocr2pdf : puts hOCR data into the pdf (behind images)
hocr2pdf comes with exactimage
-i inputfile
-o output pdf
-n : no image, allows to skip the image normally shadowing the text to either save storage space or take a look how exactly the glyphs are positioned.
-s : sloppy text can improve copy paste text

example:
hocr2pdf -i scan.tiff -s -o test.pdf < cuneiform-out.hocr

%%% Tools / scripts to do it
gkovacs-pdfocr (https://github.com/gkovacs/pdfocr)
pdf2ocr (http://blog.konradvoelkel.de/2010/01/linux-ocr-and-pdf-problem-solved/)

# watchocr is a linux distribution acting as server to do this (using hocr2pdf and cuneiform)

%%% Script 1 - Using Tesseract 3

#!/bin/bash
echo "usage: pdfocr.sh document.pdf \"author\" \"title\""
# Adapted from http://blog.konradvoelkel.de/2010/01/linux-ocr-and-pdf-problem-solved/ 
# NOTE: This script has been substantially modified/simplified from the original. 
# This version does not allow rotation, language selection or cropping.
# Those parameters were all required in the original, but I don't really need them.
# If you can think of a way to make them optional, please share. 
# This version also uses Tesseract, which I find to be substantially more
# accurate than Cuneiform for English text. 
# usage examples:
pdftk "$1" burst dont_ask
for f in pg_*.pdf
do
echo "pre-processing $f ..."
convert -quiet -density 300 -depth 8 "$f" "$f.tif"
echo no splitting
done
for f in pg_*.tif
do
echo "processing $f ..."
tesseract "$f" "$f" hocr
echo "Merging TIFF and hOCR into PDF file at 150 DPI..."
#Downsample to cut down on file bloat
hocr2pdf -r 150 -i "$f" -o "$f-ocr.pdf" <"$f.tif.php"
done

echo "InfoKey: Author" > in.info
echo "InfoValue: $2" >> in.info
echo "InfoKey: Title" >> in.info
echo "InfoValue: $3" >> in.info
echo "InfoKey: Creator" >> in.info
echo "InfoValue: PDF OCR scan script" >> in.info
pdfjoin --fitpaper --tidy --outfile "$1.ocr1.pdf" "pg_*-ocr.pdf"
rm -f pg_*
pdftk "$1.ocr1.pdf" update_info doc_data.txt output "$1.ocr2.pdf"
pdftk "$1.ocr2.pdf" update_info in.info output "$1-ocr.pdf"
rm -f "$1.ocr1.pdf" "$1.ocr2.pdf" doc_data.txt in.info

%%% Script 2 using cuneiform
#!/bin/bash
pdftk "$1" burst dont_ask
for f in pg_*.pdf
do
echo "pre-processing $f ..."
convert -quiet -rotate $[90*$2] -monochrome -normalize -density 300 "$f" "$f.png"
convert -quiet -crop $6x$7+$4+$5 "$f.png" "$f.png"
if [ "1" = "$3" ];
then
    convert -quiet -crop $[$6/2]x$7+0+0 "$f.png" "$f.1.png"
    convert -quiet -crop 0x$7+$[$6/2]+0 "$f.png" "$f.2.png"
    rm -f "$f.png"
else
    echo no splitting
fi
rm -f "$f"
done

for f in pg_*.png
do
echo "processing $f ..."
convert "$f" "$f.bmp"
cuneiform -l $8 -f hocr -o "$f.hocr" "$f.bmp"
convert -blur 0.4 "$f" "$f.bmp"
hocr2pdf -i "$f.bmp" -s -o "$f.pdf" < "$f.hocr"
rm -f "$f" "$f.bmp" "$f.hocr"
done

echo "InfoKey: Author" > in.info
echo "InfoValue: $9" >> in.info
echo "InfoKey: Title" >> in.info
echo "InfoValue: $10" >> in.info
echo "InfoKey: Creator" >> in.info
echo "InfoValue: PDF OCR scan script" >> in.info
pdfjoin --fitpaper --tidy --outfile "$1.ocr1.pdf" "pg_*.png.pdf"
rm -f pg_*.png.pdf
pdftk "$1.ocr1.pdf" update_info doc_data.txt output "$1.ocr2.pdf"
pdftk "$1.ocr2.pdf" update_info in.info output "$1-ocr.pdf"
rm -f "$1.ocr1.pdf" "$1.ocr2.pdf" doc_data.txt in.info
rm -rf pg_*_files

%%%
pdftk infile.pdf burst dont_ask
pdftk infile.pdf dump_data
pdftoppm pg_001.pdf > pg_001.ppm
cuneiform -l language -f hocr -o  out.hocr file.ppm'
ocroscript recognize file.ppm > out.hocr"
hocr2pdf -i file.ppm -s -o infile-new.pdf < out.hocr"

pdftk infile*-new.pdf cat output merged.pdf
pdftk merged.pdf update_info pdfinfo.txt output outfile.pdf

%%% Tesseract 3
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev
sudo apt-get install zlibg-dev
sudo apt-get install leptonica
svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/ tesseract-ocr-read-only
./runautoconf
./configure
make
sudo make install
#download language data
cd /usr/local/share/tessdata
sudo wget http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz

#activate hocr
cd /usr/local/share/tessdata/configs
sudo vi hocr

You need to know how to use Vim to do this bit
Put this in: "tessedit_create_hocr 1"
Save with ":x"

#usage
Convert -density 300 scanpage1.pdf -depth 8 scanpage1.tif
Tesseract scanpage1.tif outputtext
Tesseract scanpage1.tif outputtext hocr

pdftk burst test.pdf

convert -quiet -monochrome -normalize -density 300 pg_0001.pdf pg_0001.png
convert pg_0001.png pg_0001.bmp
convert -quiet -density 300 -depth 8 -monochrome -normalize pg_0001.pdf pg_0001.tif
convert -quiet -density 300 -depth 8 -monochrome -normalize pg_0001.pdf pg_0001.bpm

tesseract pg_0001.bmp pg_0001 hocr
tesseract pg_0001.tif pg_0002 hocr
tesseract pg_0001.png pg_0003 hocr

cuneiform -f hocr -o pg_0001.hocr pg_0001.bmp

convert -blur 0.4  pg_0001.png  pg_0004.bmp
hocr2pdf -i pg_0001.bmp  -n -s -o out_0001.pdf < pg_0001.php
hocr2pdf -i pg_0001.tif  -n -s -o out_0002.pdf < pg_0002.php
hocr2pdf -i pg_0001.png  -n -s -o out_0003.pdf < pg_0003.php
hocr2pdf -i pg_0001.png  -n -s -o out_0005.pdf < pg_0004.php

hocr2pdf -i pg_0001.png  -n -s -o out_0004.pdf < pg_0001.hocr

#hocr2pdf -i "$f.bmp" -n -s -o "$f.pdf" < "$f.hocr"

#rm -f "$f" "$f.bmp" "$f.hocr"
rm -f "$f ""$f.bmp"

5.19 Antivirus for linux- ClamAV - freshclam

aptitude install clamav

5.20 Install Microsoft Office 2007

%%%
For debian squeeze:
- maybe there is a way by using wine-unstable (wine 1.1.42)
- Otherwise (what I've done) download the .deb for wine 1.2 for ubuntu jaunty
This will require you to desinstall the previous wine. And it's best if you remove your ~/.wine directory first

then do a winecfg

do the install
(if you can't type the product key, you probably installed riched20 librairie with winetricks, remove it)

%%% Minimum, it worked
get winetricks
winetricks corefonts tahoma vcrun2005sp1 wsh56js allfonts

%%% Font smoothing
wget http://files.polosatus.ru/winefontssmoothing_en.sh
bash winefontssmoothing_en.sh

%%% xls2latex
#1 
I manage to get xls2latex working, by adding this macro to the custom toolbar on top of the ribbon
Open xls2latex
Click on top of the ribbom -> Customize commands -> Macro -> ToLatexTable
#2
I modified the VBA code, now it's working. Use the File Excel2Latex?Linux.
Execute CreateCommandBar
It should be in addins now
I removed the buggy forms
It copy the latex table in the clipboard

%%% More??? 
./winetricks msxml3 dotnet20 gdiplus riched20 riched30 vcrun2005sp1 allfonts

5.21 Mount .bin/.cue - convert them to .iso

The easiest: convert them to iso with bchunk

sudo aptitude install bchunk

The syntax from bchunk is as follows:
bchunk [-v] [-p] [-r] [-w] [-s]

bchunk image.bin image.cue image.iso
Mount the iso:
mount -o loop -t iso9660 image.iso /mnt/image

5.22 pdf2png - pdftopng

Best I found:
convert -density 300 -format png npoints3.pdf npoint3.png

Bof:
convert -quality 100 npoints3.pdf npoint3.png
mogrify -quality 100 -format png npoints3.pdf
 
Ma solution :  (NON ACTUALISE)
Compiler le code source redhat de  Kristian Hogsberg <krh@redhat.com>
(Informatique/Programmation/C/pdf2png)
Chercher cairo/test sur internet

Makefile.am*
Makefile.win*
pdf2png.c*
pdf2png.dev*
pdf2png.layout*
poppler-action.cc*
poppler-action.h*
poppler-attachment.cc*
poppler.cc*
poppler-document.h*
poppler-features.h.in*
poppler.gidl*
poppler.h*
poppler-page.cc*
poppler-page.h*
poppler-private.h*
test-poppler-glib.c*

5.23 Fuseiso - Monter iso facilement- thunar shortcut

adduser manu fuse

##Mounting command:
fuseiso -n -p %f %f.mount
appearance conditions:
*.iso;*.ISO;*.bin;*.BIN;*.nrg;*.NRG;*.mdf;*.MDF

## Unmouting command:
fusermount -u %f
*.mount

5.24 Meld : File/Folder comparison- thunar shortcut

meld %F

5.25 Catfish : Find files- thunar shortcut

catfish --fileman=thunar --path=%f
(on directories)

5.26 Java - iceweasel debian - Network problem

installing java:
aptitude install sun-java6-jre sun-java6-plugin
update-java-alternatives --set java-6-sun

Here is the solution.

open file
/etc/sysctl.d/bindv6only.conf and set net.ipv6.bindv6only=0, then restart the procfs with invoke-rc.d procps restart

here are the corresponding bugs

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560238
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056

This wasted quiet some time for me, so I thought I'd warn you.
It happens if you update package netbase to 4.40 and it can affect other apps too, especially if they are not from the debian repos.
A real debian special ...

5.27 Snapshot - Capture d'ecran

xfce4-screenshooter

5.28 FOR LOOPS/ FIND / XARGS and SPACE CHARACTERS -> Find in PDF

bash uses space characters as default separators. This is set with the varialble $IFS

#Option 1
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in *
do
  echo "$f"
done
IFS=$SAVEIFS

#Option 2
find . -print0 | while read -d $'\0' file
do
  echo -v "$file"
done

# Application : Script to find in pdf :

#! /bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

echo "Looking for "$1
for i in `find -name "*.pdf" -printf '%h/%f\n'  2> /dev/null`
do
	echo "----------------------------"
	echo "$i";
	echo "----------------------------" 
	pdftotext $i - |grep --color=always $1
#	 strings "$i"  |grep $1
done; 
IFS=$SAVEIFS

5.29 Iceweasel / Firefox et java plugin

Récapitulatif d'installation de JAVA et des plugins Java dans Iceweasel

J'ai téléchargé jre-6u1-linux-i586.bin ici
http://sdlc5c.sun.com/...

J'ai changé les propriétés d'accès du fichier afin de pouvoir l'exécuter.
#chmod +x jre-6u1-linux-i586.bin

J'ai exécuté le fichier à l'aide de la commande suivante :
#./jre-6u1-linux-i586.bin

Un répertoire nommé jre1.6.0 vient d'être créé. J'ai déplacé ce répertoire dans le répertoire /opt qui va contenir toutes les applications utilisateurs propriétaires.
#mv -f jre1.6.0_01/ /opt/

J'ai ajouté les liens vers les binaires nécessaires à l'aide des commandes suivantes :
#ln -s /opt/jre1.6.0_01/bin/java /usr/local/bin/java
#ln -s /opt/jre1.6.0_01/bin/policytool /usr/local/bin/policytool

J'ai renseigné le reste du système que la Java Runtime Environment est installée en ajoutant la ligne suivante au fichier /etc/environment
#echo JAVA_HOME=/opt/jre1.6.0_01 >> /etc/environment

Création de lien vers libjavaplugin_oji.so
#ln -sfv /opt/jre1.6.0_01/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/iceweasel/plugins

5.30 VISIO 2003

L'installation marche
#Pour resoudre l'erreur  IOPL not enabled :
winecfg
#Go to the Libraries tab, and add an entry called gdiplus. Then, edit the entry you just added, and select Native (Windows).

5.31 Firefox / iceweasel slow, tweak it

%%% about:config dans la barre d'addresse
#network.dns.disableIpv6   desactiver l'Ipv6 
#Create new Boolean value set to true : config.trim_on_minimize  to release memory when iconified, risky
#Create new Integer value set to 0 : nglayout.initialpain.delay   to instantateously show page 
#set browser.cache.memory.capacity to a fixed size (the default values are: for 256 MB RAM - 14336, 512 MB RAM - 22528, 1 GB RAM - 32768). A good value to try is 16384. 
#set browser.sessionhistory.max_total_viewers to 0
#change image.animation_mode to none or once
#browser.sessionhistory.max_entries set it to 5

%%% Tools/Options.
    set the disk cache memory to a low value (less than 50 MB)
    turn off Java
    try to avoid these extensions: Adblock, Fasterfox, IE Tab, Session Saver. Use Adblock Plus instead of Adblock.
    don't use more than 5 extensions

Other tweaks that can be done in the user.js file
ou (pref.js quand firefox is closed)

or by about:config

/* Speed Tweak - Common to all Configurations */
user_pref("network.http.pipelining", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.maxrequests", 8);
user_pref("content.notify.backoffcount", 5);
user_pref("plugin.expose_full_path", true);
user_pref("ui.submenuDelay", 0);
/* Speed Tweak - Fast Computer Fast Connection */
user_pref("content.interrupt.parsing", true);
user_pref("content.max.tokenizing.time", 2250000);
user_pref("content.notify.interval", 750000);
user_pref("content.notify.ontimer", true);
user_pref("content.switch.threshold", 750000);
user_pref("nglayout.initialpaint.delay", 0);
user_pref("network.http.max-connections", 48);
user_pref("network.http.max-connections-per-server", 16);
user_pref("network.http.max-persistent-connections-per-proxy", 16);
user_pref("network.http.max-persistent-connections-per-server", 8);
user_pref("browser.cache.memory.capacity", 65536);

Disabling ipv6 is the biggie that tends to speed things up. As mentioned in the "other" thread.
/* Speed Tweak - Another Tweak */
user_pref("network.dns.disableIPv6", true);

/* Tor Settings */
user_pref("network.http.keep-alive.timeout",600);
user_pref("network.http.proxy.keep-alive",true);

# Perso : 
# Pour avoir les tab de memes tailles, modifier les tab options 
max_tabs_undo
tabMaxWidth
tabMinWidth

5.32 PDF Croping - suppression d'espace de marges

% Now, I'm using bliss a java application

#Utiliser pdfcrop (script perl d'Eric Doviak et Mark Sherry) disponible sur source forge

#Sinon, pour avoir la taille (old stuff)
identify x.pdf
Puis
convert -crop 10+10+0+0 x.pdf y.pdf

# Recently : I found it to work by first converting to png with a density chosen (between 100 and 300 depending) 
for i in *.pdf ; do convert -density 150 $i tmp/${i%.*}.png;  done
identify *    (gives W0xH0)
concert -crop W2xH2+L2+T2 +repage x.png y.png
Option +repage is important, it remove the canvas information, set it to the new image size.

#convert -crop 950x1160+280+160 +repage x.png y,png

5.33 Renommage massif unix

ca depend de la version de rename
rename "s/mp4/mp3/g" *.mp4

rename .mp3 .mp4 *.mp3

rename "s/mp4/mp3/" *.mp4
for i in *htm; do mv $i `basename $i htm`html; done 
for i in *htm; do mv $i ${i%%.htm}.php; done

5.34 Faire un dictionaire - Compter le nombre de keywords d'une page web

unalias grep

-Virer les commandes HTML : sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
-Utiliser tr pour transformer un character en un autre (espace en newline) : tr ' ' '\n'
-Virer la ponctuation : tr -d '[:punct:]'
-Virer les lignes avec des caracteres qui ne sont pas des lettres(tab, nombres...) : grep -v '[^a-z]'
-Virer les mots de moins de 2 lettres et les lignes vides:  grep -E '[a-z]{3,}' 
-Mettre tout en lower case :  tr '[:upper:]' '[:lower:]'
-Virer les mot communs :
   grep -v -E -w 'the|and|for|from|with|used'
-Trier avec sort
-Compter les occurences avec uniq et l'option -c : uniq -c
-Trier par nombre reverse: sort -rn

cat *php* | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | tr ' ' '\n'  | tr -d '[:punct:]' | grep -v '[^a-z]'| grep -E '[a-z]{3,}' | tr '[:upper:]' '[:lower:]' | grep -v -w -E 'the|and|for|from|with|used|which|are|that|this|will|can|been|should|using|all|one|two|three|has|taken|where|made|also|thus|though|have|when|not|such|figure|table|these|could|seen|given|nbsp|les|des|from|different|est|dans|une|our|qui|between|next|would|sont|its|see|son|plus|case|que|pour|suivant|nous|par|sur|each|but|than|only|other|main|figures|tables|more|there|value|values|were|was|low|high|around|since|very|order|per|into|first|because|found|them|done|good|their|really|here|got|big|better|well|away|shown|over|like|while|within|take|due|any|then|under|same|much|most|both|second|lot|use|get|pas|mais|alors|peut|plot|left|right' | sort | uniq -c| sort -rn|head -50 |sed 's/'[\ 0-9]'//g' |xargs

cat SUPERFILE | grep -E '[a-z]{3,}' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' >SUPERFILE2

cat SUPERFILE3 | grep -v -w -E 'the|and|for|from|with|used|which|are|that|this|will|can|been|should|using|all|one|two|three|has|taken|where|made|also|thus|though|have|when|not|such|figure|table|these|could|seen|given|nbsp|les|des|from|different|est|dans|une|our|qui|between|next|would|sont|its|see|son|plus|case|que|pour|suivant|nous|par|sur|each|but|than|only|other|main|figures|tables|more|there|value|values|were|was|low|high|around|since|very|order|per|into|first|because|found|them|done|good|their|really|here|got|big|better|well|away|shown|over|like|while|within|take|due|any|then|under|same|much|most|both|second|lot|use|get|pas|mais|alors|peut|plot|left|right' | sort | uniq -c| sort -rn|head -300

cat test |grep -v -w -E 'the|and|for|from|with|used|which|are|that|this|will|can|been|should|using|all|one|two|three|has|taken|where|made|also|thus|though|have|when|not|such|figure|table|these|could|seen|given|nbsp|les|des|from|different|est|dans|une|our|qui|between|next|would|sont|its|see|son|plus|case|que|pour|suivant|nous|par|sur|each|but|than|only|other|main|figures|tables|more|there|value|values|were|was|low|high|around|since|very|order|per|into|first|because|found|them|done|good|their|really|here|got|big|better|well|away|shown|over|like|while|within|take|due|any|then|under|same|much|most|both|second|lot|use|get|pas|mais|alors|peut|plot|left|right' | sort | uniq -c| sort -rn|head -300

5.35 Aspirer un site avec wget

http://forum.ubuntu-fr.org/viewtopic.php?id=78954

wget -r -l1 -k -E -A *svg http://www.openclipart.org/user-cliparts/johnny_automatic?page=$i

wget -r -l5 -k -E -np www.unsite.com

       `--no-parent' Do not ever ascend to the parent directory when
       retrieving recursively.  This is a useful option, since it guarantees
       that only the files _below_ a certain hierarchy will be downloaded.
       see "Directory-Based Limits", for more details.

Explication :

-r : récursif sur le site
-l5 : cinq niveaux de récursion au maximum
-k : convertir les destinations des liens pour une lecture locale
-E : convertir les types de fichier au format HTML (pour éviter que la lecture de sites en PHP ne foire en lecture sous Firefox).
-np: --no-parent' Do not ever ascend to the parent directory
-A : +list of file types patterns
-c : continue previously stopped download

---------

Pour aller plus loin.

Si vous voulez plus d'options, la page de manuel de wget est pleine d'infos utiles, voici des options très intéressantes :
-t : spécifier combien de fois que wget devrait essayer de télécharger chaque fichier.
-w : spécifier combien de temps attendre entre les essais
-c : demander à wget de continuer un téléchargement interrompu.
-T : spécifier au bout de combien de secondes sans réponse wget abandonne une connexion
--limit-rate : mettre une vitesse de connexion maximale pour ne pas monopoliser votre bande passante
-Q : limiter la place que prendront tous les fichiers téléchargés, pour ne pas trop remplir votre disque dur. Dès qu'à la fin d'un téléchargement le quota sera dépassé, wget s'arrêtera
--load-cookies : importer des cookies (pratique pour les sites où vous devriez être authentifié)
-X : exclure un répertoire

5.36 Modification pdf - Avec le paquet pdftk

# Concaténer les fichiers A1 et A2 pour obtenir le fichier B.pdf
pdftk A1.pdf A2.pdf cat output B.pdf
# Supprimer les 2 premières pages d'un document de 9 pages
pdftk original.pdf cat 3-9 output final.pdf
# Supprimer les page 6 et 7
pdftk original.pdf cat 1-5 8-end output final.pdf

# Garder les pages 69 a 117 impaire
pdftk original.pdf cat 69-117odd output final.pdf

pdftk `ls -1 *.pdf|sort -g|xargs` cat output out.pdf 

#decomposer en plusieurs fichiers
pdftk chap.pdf burst

# Rotate an entire PDF document to 180 degrees
pdftk in.pdf cat 1-endS output out.pdf

5.37 Manipulation d'images en masse : image magick

display : interface graphique moyen (mauvais gimp)

Plusieurs outils pour multiples fichiers dont mogrify
- "mogrify" modifie les image en places alors que
- "convert" les sauve sous un autre nom
- "identify" pour donner des info sur l'image

Options utiles :
mogrify -resize 800x600 *.JPG
mogrify -resize 50% *.JPG
mogrify -negate test.jpg
mogrify -monochrome test.jpg
mogrify -format jpg *.png
mogrify -scale 110x2 *.png  # wouldn't work with 110x1

#Animation Gif
convert -delay 20 -loop 0 sphere*.png animation.gif
animate *.gif

convert fig13.png -crop 1530x1210+75+95 test.png

mkdir 16x16
mkdir 24x24
mkdir 32x32
mkdir 48x48
export fold=actions
cd $fold
export size=16x16
mkdir ../$size/$fold
mogrify -resize $size -path ../$size/$fold *.png
export size=24x24
mkdir ../$size/$fold
mogrify -resize $size -path ../$size/$fold *.png
export size=32x32
mkdir ../$size/$fold
mogrify -resize $size -path ../$size/$fold *.png
export size=48x48
mkdir ../$size/$fold
mogrify -resize $size -path ../$size/$fold *.png

5.38 Evince cannot open any pdf documents anymore

remove 
/usr/local/share/mime/mime.cache
or 
~/.local/share/mime/mime.cache

5.39 Audio format conversion : ogg, au, mp3, wav, snd,aiff ...

SoX is able to handle formats like Ogg Vorbis, MP3, WAV, AIFF, VOC, SND, AU, GSM

sudo aptitude install sox libsox-fmt-all

5.40 dos2unix : package tofrodos

Convertit un point bat

5.41 Listen ou Exaile ou Quod libet ou banshee ou xrmms pour remplacer Amarok

aptitude install listen
aptitude intsall exaile

5.42 WICD pour remplacer Gnome Netwok Manager

aptitude install wicd

5.43 Installer un nouveau pager : most

better than more or less
     Le pager est un programme qui sert à afficher du texte. Vous avez le choix entre plu-
sieurs programmes, grâce à un mécanisme d'alternatives. Je vous propose d'installer
et d'utiliser most, un pager qui permet entre autres de colorer les pages de manuel.
# aptitude install most
# update-alternatives --config pager
     La seconde commande vous demnde de choisir le pager à utiliser. Répondez en
donnant le numéro qui correspond à most. Maintenant, c'est ce programme qui sera
utilisé pour afficher les manuels.

5.44 Gparted equivalent

Dur a trouver. => parted en ligne de commande
De toute facon, il faut des partitions demontees, donc utilisation d'un live CD.
Inutile d'installer gparted

5.45 Logiciels equivalent linux / windows

http://wiki.linuxquestions.org/wiki/Linux_software_equivalent_to_Windows_software
http://www.libervis.com/wiki/index.php?title=Table_of_Equivalent_Software

5.46 Personaliser xterm

xrdb ~/.Xdefaults

prompt colore : (variable PS1)
par default : ${debian_chroot:+($debian_chroot)}\u@\h:\w\$
export PS1='\033[1m\033[1;33m\u:\e[32;1m\w\e[33;1m$ \033[m'
export PS1='\[\033[1m\]\[\033[1;33m\]\u:\[\e[32;1m\]\w \[\e[33;1m\]\$\[\033[m\] '

vim .bashrc
# some more ls aliases
alias ll='ls -lhb'
alias ls='ls -F --color=always'
alias la='ls -lAXh|more'
alias lag='ls -lAgXh|grep'
alias lsd='ls -l|grep drwx'
alias lag='ls -lAgXh|grep'
alias lsd='ls -l|grep drwx'
alias dir='ls --color=auto --format=vertical'
alias cd..='cd ..'
alias grep='grep --color=always'

alias cp='cp -i '
alias mv='mv -i '
alias rm='rm'

alias gedit='geany'
alias mydiff='diff -a -b -B -w -y -i --suppress-common-lines '
alias mydiffb='diff -a -b -B -w -y -i '
alias filemanup="java -jar /home/share/Config/Applications/File-manupilation-v1.315/File-Manupilation-v1.315.jar"
alias alarmaniac="java -jar /home/share/Config/Applications/Alarmaniac/alarmaniac.jar"
                
vim .Xdefaults

! xterm ----------------------------------------------------------------------
xterm*faceName:           monospace:pixelsize=14
!xterm*dynamicColors:      true
!xterm*utf8:               2
!xterm*eightBitInput:      true
xterm*scrollTtyKeypress:  true
xterm*scrollTtyOutput:    false
xterm*scrollBar:          true
xterm*rightScrollBar:     true
xterm*jumpScroll:         true
xterm*multiScroll:        true
xterm*background: black
xterm*foreground: green
xterm*title : xterm
xterm*vt100.geometry : 80x28
XTerm*reverseVideo : on
XTerm*SaveLines: 1000

! Xcursor --------------------------------------------------------------------
Xcursor*theme: Vanilla-DMZ-AA
Xcursor.size:  22

A mettre dans le .xinitrc
xrdb ~/.Xdefaults

5.47 RAW photo images nikon .NEF

ufraw --out-type jpg --compression 90 *.NEF







Emmanuel Branlard