jeudi 30 mai 2013

OpenWithVLC

cd ~/.local/share/nautilus/scripts
gedit ~/.local/share/nautilus/scripts/OpenWithVLC

COPIE/COLLE
#!/bin/bash

## Ny Narendra Sisodiya, for SchoolOS
## narendra.sisodiya@gmail.com
## modified by: IRFAN NASEEF P
##             irfan@nitc.ac.in

checkFileType()
{
  file $1 | grep -i "audio" || file $1 | grep -i "video" || file $1 | grep -i "ogv" || file $1 | grep -i "mpeg"
  RES=$?
  if [ $RES -eq 0 ]
  then
      return 0
  else
      zenity --error --title "VLC says: " --text "Error: $FILENAME is not an audio/video file"
      return 1
 
   
   fi
}

IFS=$'\n'
for FILENAME in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
do
  checkFileType $FILENAME

  if [ $? -eq 0 ]
  then
    vlc --started-from-file --one-instance-when-started-from-file --playlist-enqueue "$FILENAME"
    
 fi
done

exit 0

################

SAUVEGARDER
ou

#!/bin/sh
path=$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
result=""
cnt=0
for i in $path
do
if [ $cnt -eq 0 ]
then
result=$i
else
result=$result'\ '$i
fi
cnt=`expr $cnt + 1`
done
#vlc --playlist-enqueue "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
vlc --playlist-enqueue "$result"

mercredi 29 mai 2013

#monitoring #Moniteurs #surveillance #serveur


Webmin
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib 

cd /root
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc

apt-get update
apt-get install webmin


ou
Ajenti
Install Easy Hosting Control Panel (EHCP) in Ubuntu 12.10 Server

GNetWatch

#email (fouretout)

NoPriv.py - HTML5 IMAP email backup

Coccimail Capture Aspiration des adresses email

Avertisseur d'emails en arrivés :
github.com/nassir-malik/IOT-Pi3-Alexa-Automation

Services de boites email :
www.autistici.org/fr
www.bigsenders.com
freeola.com/free-email
mail.google.com
mail.yahoo.com
help.riseup.net
www.inbox.com
www.mailoo.org
www.meysend.com
www.openmailbox.org
protonmail.ch - protonmail.com/fr/
roundcube.net
tutanota.de

Messageries chiffrés :
Caliopen
Dark Mail
Lavaboom
Protonmail
StartMail
Tutanota
Unseen

Cartes graphiques

Intel(R) Linux Graphics Installer

AMD site
AMD/Softpedia

TBS Cartes tuner

GraphicsMagick (utilisation)

installer
sudo apt-get install graphicsmagick

telecharger webGraphicsMagick

recupérer le script (en ce plaçant dans le répertoire des images) de compression pour les images PNG/JPG :

wget https://raw.github.com/bingalls/webGraphicsMagick/master/compressLossy.sh
chmod +x compressLossy.sh

./compressLossy.sh



Moniteurs système

INSTALLATION CPU-G
sudo add-apt-repository ppa:cpug-devs/ppa
sudo apt-get update
sudo apt-get install cpu-g
INSTALLATION I-NEX
sudo add-apt-repository ppa:nemh/gambas3
sudo add-apt-repository ppa:i-nex-development-team/stable
sudo apt-get update
sudo apt-get install i-nex
 
Autres :
CPU-X
Monitorix

nmon is short for Nigel's Performance Monitor It either shows you the stats on-screen updating once a second or saves the data to a CSV file for later analysis and graphing. For details see the homepage nmon.sourceforge.net

Stacer 

Remplacer MySQL

https://downloads.mariadb.org/mariadb/repositories/

(infos)

#Redimensionner #compresser #reduire #convertir #PDF #commande #Linux

En de nombreuses occasions, vous voudrez peut-être redimensionner un fichier PDF à envoyer par e-mail ou le mettre sur le web.
Pour utiliser Linux vous avez juste besoin du programme à tout faire ghostscript et avec quelques commandes que vous aurez vos documents redimensionnées.
Par exemple, un document de 50Mo prend 15Mo une fois que le PDF redimensionné en conservant une bonne qualité.


Première chose, l'installation de ghostscript , pour Ubuntu / Debian et Mint il suffit d'exécuter cette commande :
  sudo apt-get install ghostscript 
Et maintenant, pour redimensionner votre PDF, vous pouvez utiliser cette commande :
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen 
 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Remplacez le nom de fichier output.pdf et input.pdf avec vos noms de fichiers.
Ce sont les options que vous pouvez utiliser pour sélectionner la qualité de la production:

-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)

ou
sudo apt-get install ghostscript
cd wget http://www.alfredklomp.com/programming/shrinkpdf/shrinkpdf.sh chmod +x shrinkpdf.sh
exemple :
./shrinkpdf.sh source.pdf destination.pdf

gs -dPDFSETTINGS=/prepress -dSAFER -dCompatibilityLevel=1.5 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -dGrayImageResolution=600 -dMonoImageResolution=1200 -dColorImageResolution=300 -sOutputFile=vol_iv_gs.pdf -c .setpdfwrite -f vol_iv.pdf
SUR WINDOWS ON UTILISE LA COMMANDE SOUS LA FORME
gswin32 -dPDFSETTINGS=/prepress -dSAFER -dCompatibilityLevel=1.5 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -dGrayImageResolution=600 -dMonoImageResolution=1200 -dColorImageResolution=300 -sOutputFile=vol_iv_gs.pdf -c .setpdfwrite -f vol_iv.pdf

Pour plusieurs fichiers : 
for file in *.pdf; do output_file=$(echo "$file" | sed -re 's/\.pdf$/out.pdf/'); gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$output_file" "$file"; done 
 

Linux: How to convert a color pdf to black-white
gs \
  -sOutputFile=sortie_gris.pdf \
  -sDEVICE=pdfwrite \
  -sColorConversionStrategy=Gray \
  -dProcessColorModel=/DeviceGray \
  -dCompatibilityLevel=1.4 \
   source_couleur.pdf

ShrinkPDF
Using ps2pdf

Regrouper des fichiers Jpeg dans un PDF grâce à ImageMagick :
convert *.jpg livret.pdf

Convertir un PDF couleur en niveaux de gris grâce à ImageMagick :

convert -colorspace GRAY input.pdf output.pdf


ebook-convert
eCub
writer2epub pour LibreOffice

3 astuces PDF sous Ubuntu

Comment extraire les images d'un fichier PDF sur Ubuntu / Mint

Conversion chm vers pdf :

 chm2pdf --book sample.chm sample.pdf


cbr2pdf

Extraire le texte et les images d'un fichier pdf

#!/bin/bash
if [ $# -eq 0 ];
then
    echo "Il manque le nom du fichier"
    exit 1
else
    ROOT="/home/user/Bureau/extractPdf"
    outPdf="$ROOT/pdf"
    outText="$ROOT/text"
    outImg="$ROOT/images"

    echo -n "Numéro de la première page : "
    read firstPage
    echo -n "Numéro de la denière page : "
    read lastPage

    echo -n "Masque des fichiers jpg et pdf extrait : "
    read fileNameOut
    
    if [ -z $fileNameOut ];
    then
        echo "Masque de fichier vide"
        exit 1
    else
        echo "+-----------------------+"
        echo "| Extraction des images |"
        pdfimages -f $firstPage -l $lastPage -p  -j $1 $outImg/$fileNameOut

        echo "| Découpage du fichier  |"
        pdfseparate -f $firstPage -l $lastPage $1 $outPdf/$fileNameOut-%d.pdf
        
        echo "| Extraction des textes |"
        echo "+-----------------------+"        
        for FILE in `ls $outPdf`
        do
            pdftotext -raw -nopgbrk $outPdf/$FILE $outText/${FILE%%.*}.txt
            while read ligne
            do
                ligne=`echo $ligne | tr '\r\n' ';'`
                echo -n $ligne >> $outText/$fileNameOut-full.csv
            done < $outText/${FILE%%.*}.txt
            echo "" >> $outText/$fileNameOut-full.csv            
        done        
    fi
fi
exit 0

Conversion PDF en JPG

convert -quality 100 -density 600x600 mondoc.pdf monimage.jpg
   convert METTRE_ICI_LE_NOM_DU_DOCUMENT.pdf output.png

Conversion d'une page de man vers un fichier pdf
man -t convert | ps2pdf - > convert.pdf
man -t imagemagick | ps2pdf - > imagemagick.pdf
 

Extraire des images d'un fichier PDF :

pdftoppm EXEMPLE.pdf labd

CBR2PDF

Conversion PDF vers CBR avec le scrit PDFtoCBR.sh :

#!/bin/sh

mkdir "`basename \"$1\" .pdf`"
cp "$1" "`basename \"$1\" .pdf`/bd.pdf"
cd "`basename \"$1\" .pdf`"

convert -compress JPEG2000 -quality 75 $f Page.jpg

ls | sed -rn "s/^bd-([0-9]{1})_1\.jpg/mv '&' 'Page-000\1.jpg' /p" |sh
ls | sed -rn "s/^bd-([0-9]{2})_1\.jpg/mv '&' 'Page-00\1.jpg' /p" |sh
ls | sed -rn "s/^bd-([0-9]{3})_1\.jpg/mv '&' 'Page-0\1.jpg' /p" |sh

rar a "../`basename \"$1\" .pdf`.cbr" *; 
cd ..; 
rm -rf "`basename \"$1\" .pdf`"
 

Compiler plusieurs fichiers PDF en un seul fichier :

pkftk *.pdf cat output compil.pdf
 

Pdftk the-pdf-toolkit
Pdftk/Ubuntu
Pdftk exemples
Pour 1 rotation à 90° sens horaire :
pdftk original.pdf cat 1-endeast output destination.pdf

Sites pour le PDF :

www.icaunux.org/doku.php?id=logiciels_de_modification_de_pdf
www.zyyne.com/site/
www.pdfhacks.com
www.pdftohtml.net
pdfzen.com
www.pdfescape.com


Easily Resize PDF on Mac OSX and Linux

On many occasions, you might want to resize a PDF to send it by Email or put it on the web. There are many useless Share- and Bloatware-tools (like Adobe Acrobat) that might or might not help you with that.
If you happen to work on a Linux, BSD or Mac OSX machine, you can simply use ghostscript for the task. It’s much faster and gets better filesizes than the Optimize-function of Adobe Acrobat.
All you need to do is to make sure ghostscript is installed and then put the following shortcut in your .profile or .bashrc in your home-directory.

pdfResize() {
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/$1 -sOutputFile=output.pdf $2
}
After that’s done, open a new Terminal-window and try the following command:
pdfResize screen MyDocument.pdf
You should now find the resized document in a file called output.pdf in the same directory.
The first argument sets the quality. Available options are screen, ebook and printer. While screen gives you the smalles file size, printer provides better quality at a reasonable filesize.

Extraire des images d'un PDF avec imagemagick :
<?php
 exec('/path/to/imagemagick');
?>

Create GIF Thumbnail of First PDF Page

<?php //the path to the PDF file $strPDF = "my_pdf.pdf"; exec("convert \"{$strPDF}[0]\" -colorspace RGB -geometry 200 \"output.gif\""); ?>

Create JPEG Thumbnails of ALL Pages Within PDF

<?php //the path to the PDF file $strPDF = "my_pdf.pdf"; exec("convert \"{$strPDF}\" -colorspace RGB -geometry 200 \"output.jpg\""); ?>

Create Large PNG 1024px Image of First PDF Page

<?php //the path to the PDF file $strPDF = "my_pdf.pdf"; exec("convert \"{$strPDF}[0]\" -colorspace RGB -geometry 1024 \"output.png\""); ?>

Create Large PNG 1024px Images of ALL Pages Within PDF

<?php //the path to the PDF file $strPDF = "my_pdf.pdf"; exec("convert \"{$strPDF}\" -colorspace RGB -geometry 1024 \"output.png\""); ?>
 
 

Compiler / empaqueter / regrouper plusieurs images dans un fichier PDF :

convert -compress jpeg *.jpg nom_destination.pdf

Psutils, psnup, psselect, ps2pdf

Autres :

Master PDF Editor
ps2pdf: PostScript-to-PDF converter
K2pdfopt, a PDF/DJVU optimizer for mobile e-readers such as the Kindle


Pour alléger les fichiers ebooks au format .epub :


sudo apt-get install python-beautifulsoup
wget https://raw.githubusercontent.com/rupa/epub/master/epub.py
python epub.py nomeebook.epub

Script python pour les PDF :
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import shutil  #
'''
This program is Linux only.
Requires pdftops and ps2pdf14
'''
failure = "failure"
filesTo_find = ['pdftops','ps2pdf14']
errorMessage_1 = 'This program requires both pdftops and ps2pdf14.\nOne or both is missing. Please install to allow this program to function'
errorMessage_2 = 'This program does not yet operate on windows.\nFeel free to modify it run on a win32 system'
errorMessage_3 = 'This program does not yet operate on OS2.\nFeel free to modify it run on an OS2 system'
errorMessage_4 = 'You do not have permission to write in this directory.\nCopy the pdf to a writable directory and try again.'
found = 0
try:
    import scribus
except ImportError,err:
    print "This Python script is written for the Scribus scripting interface."
    print "It can only be run from within Scribus."
    sys.exit(1)
if sys.platform != 'win32':
     pass
else:
     result = scribus.messageBox('Sorry - Linux Only program',  errorMessage_2,)
     sys.exit()
if sys.platform != 'os2':
     pass
else:
     result = scribus.messageBox('Sorry - Linux Only program',  errorMessage_3,)
     sys.exit()
path = os.environ['PATH']
paths = path.split(os.pathsep)
for ftf in filesTo_find:
    for p in paths:
        f = p + '/' + ftf
        if os.path.isfile(f):
            found = found + 1    #need to start search for next file when first file found
            break
if found == 2:
    pass
else:
    result = scribus.messageBox('Missing Programs',  errorMessage_1,)
    sys.exit()
homedir = os.path.expanduser("~")
os.chdir(homedir)
filename=scribus.fileDialog("Reduce PDF",  "PDF files(*.PDF *.pdf)")
if os.path.isfile(filename):
  orig_size = os.path.getsize(filename)
  cmd = 'pdftops' + ' ' + filename
  os.system(cmd)
if os.path.exists(filename[:-3] + 'ps'):
  cmd2 = 'ps2pdf14' + ' ' + filename[:-3] + 'ps' + ' ' + filename[:-3] + 'new' + '.pdf'
  os.system(cmd2)
  new_size = os.path.getsize(filename[:-3] + 'new' + '.pdf')
else:
     result = scribus.messageBox('Big Boo Boo',  'Something real bad has gone wrong! Sorry',)
     sys.exit(1)
pdf_file = os.path.basename(filename)
result = scribus.messageBox(pdf_file,"Original size was" + ' ' + str(orig_size) + ' ' + "bytes" + '\n' + "New size is" + ' ' + str(new_size) + ' ' + "bytes"'\n'  )

mardi 14 mai 2013

Pour le deploiement

IzPack 
DCP Setup Maker
distro M23
Opsi
SALI is a acronym for SURFsara Automatic Linux Installation
UpdatEngine
WAPT apt-get pour window$
echo "deb http://wapt.tranquil.it/debian/ ./ " > /etc/apt/sources.list.d/wapt.list
apt-get update
apt-get install tis-waptserver tis-waptrepo tis-waptsetup

Supercopier

Disponible pour Windows, Mac et Linux >ici.<

Installer Oscopy

Oscopy est un oscilloscope sous licence GPLv2.

préalable
sudo apt-get install git autoconf gettext intltool python-gtk2-dev ipython python-matplotlib geda gnucap
ensuite
git clone git://repo.or.cz/oscopy.git
cd oscopy
git pull git://repo.or.cz/oscopy.git experimental
cd oscopy
./autogen.sh && ./configure && make install

Archives du blog