AirV's Blog

Just another blog

Recherche de fichier

Extrait de Asher256 :
Le scricpt showexe.py, permet de trouver facilement les fichiers exécutables Linux dont vous doutez du nom
L’installation du script showexe.py est assez facile, copiez (en tant que root) le script showexe.py dans le répertoire /usr/local/bin/, sous le nom showexe. Ceci étant fait, il ne vous restera qu’à le rendre exécutable et changer son utilisateur et groupe par root avec la commande :

chmod 755 /usr/local/bin/showexe
chown root:root /usr/local/bin/showexe

L’utilisation de showexe est très simple. Par exemple, pour trouver tous les programmes ayant « gimp » dans leur nom :

showexe --match gimp

Il est aussi possible d’utiliser les expressions rationnelles :

showexe --match 'fir.*x'

Cela vous donnera (à titre d’exemple) :

/usr/bin/firefox
/usr/bin/firefox-3.0
/usr/bin/firefox.debian

Information supplémentaire : si vous utilisez showexe sans arguments, tous les fichiers exécutables de votre système de fichiers seront affichés. Cela pourrait vous être utile pour utiliser un tube avec grep et filtrer grâce à ce dernier.

Vous pouvez télécharger directement showexe.py

Migrate emails from maildir to Gmail

How to migrate emails from maildir to gmail from scott.yang.id.au

 

$ python maildir2gmail.py -u username@gmail.com -p password ~/.maildir/cur
$ python maildir2gmail.py -u username@gmail.com -p password -f "Sent Mail" ~/.maildir/.Sent/cur

 

NB : pour que cela fonctionne, il m’a fallu modifier le script :

self.imap.append(self.folder, ‘(\Seen)’, timestamp, content)

self.imap.append(‘INBOX’, ‘(\Seen)’, timestamp, content)

 

Le script importe que les mails du dossier racine. Donc il faut donc déplacer tous les mails de l’arborescence à la racine du dossier qui va être exporté. Les mails portant les mêmes noms dans chaque dossier (format maildir) il faut au préalable les renommer (script /data/rozec/bin/bash/RenommerDeplacerFichierArborescence)

Atmail

Installation du client webmail Atmail

L’interface est sympathique mais :

  • nécessité de double-clic pour visualiser le mail…
  • problème de la fonction recherche

En conclusion gardons Roundcubemail !

Problème de connexion après l’installation

Sur le forum du site :

I found it easier to hack on ATMail than to reconfigure my IMAP servers

Edit libs/IMAP_Client.php
function login($user, $pass)
{
list($user, $crap) = split(« @ », $user, 2);
$this->user = $user;

Add in the underlined code, it simply strips the @domain part of the variable before attempting to log in to the server.

Then you can edit html/login-light.html and use <input type=hidden value= »your mailserver name »> in the appropriate place. Basically change the input type from text to hidden and hardcode in your values there.

It’s worked for me, mind you I’ve only just started playing with ATMail. If anyone has a more elegant solution, lets have it.

Rowscope

From Freshmeat.net :

Rowscope is a file viewer for large text files. It can read files larger than 1 GB. It is very fast, taking only a few seconds to examine a 1GB file, and it never blocks.

Expressions régulières

From HowToGeek :

What are Regular Expressions?

Regular expressions are statements formatted in a very specific way and that can stand for many different results. Also known as “regex” or “regexp,” they are primarily used in search and file naming functions. One regex can be used like a formula to create a number of different possible outputs, all of which are searched for. Alternatively, you can specify how a group of files should be named by specifying a regex, and your software can incrementally move to the next intended output. This way, you can rename multiple files in multiple folders very easily and efficiently, and you can move beyond the limitations of a simple numbering system.

Because the use of regular expressions relies on a special syntax, your program must be capable of reading and parsing them. Many batch file renaming programs for Windows and OS X have support for regexps, as well as the cross-platform searching tool GREP (which we touched on in our Bash Scripting for Beginners Guide) and the Awk command-line tool for *Nix. In addition, many alternative file managers, launchers, and searching tools use them, and they have a very important place in programming languages like Perl and Ruby. Other development environments like .NET, Java, and Python, as well as the upcoming C++ 11, all provide standard libraries for using regular expressions. As you can imagine, they can be really useful when trying to minimize the amount of code you put into a program.

A Note About Escaping Characters

Before we show you with examples, we’d like to point something out. We’re going to be using the bash shell and the grep command to show you how to apply regular expressions. The problem is that sometimes we want to use special characters that need to be passed to grep, and the bash shell will interpret that character because the shell uses it as well. In these circumstances, we need to “escape” these characters. This can get confusing because this “escaping” of characters also occurs inside regexps. For example, if we want to enter this into grep:

<

we’ll have to replace that with:

\<

Each special character here gets one backslash. Alternatively, you can also use single quotes:

‘<’

Single quotes tell bash NOT to interpret what’s inside of them. While we require these steps to be taken so we can demonstrate for you, your programs (especially GUI-based ones) often won’t require these extra steps. To keep things simple and straightforward, the actual regular expression will be given to you as quoted text, and you’ll see the escaped syntax in the command-line screenshots.

How Do They Expand?

Regexps are a really concise way of stating terms so that your computer can expand them into multiple options. Let’s take a look at the following example:

tom[0123456789]

The square brackets – [ and ] – tell the parsing engine that whatever is inside, any ONE character may be used to match. Whatever is inside those brackets is called a character set.

So, if we had a huge list of entries and we used this regex to search, the following terms would be matched:

  • tom
  • tom0
  • tom1
  • tom2
  • tom3

and so on. However, the following list would NOT be matched, and so would NOT show up in your results:

  • tomato ; the regex does not account for any letters after “tom”
  • Tom ; the regex is case sensitive!

You can also choose to search with a period (.) which will allow any character present, as long as there is a character present.

reg vs period

As you can see, grepping with

.tom

did not bring up terms that only had “tom” at the beginning. Even “green tomatoes” came in, because the space before “tom” counts as a character, but terms like “tomF” did not have a character at the beginning and were thus ignored.

Note: Grep’s default behavior is to return a whole line of text when some part matches your regex. Other programs may not do this, and you can turn this off in grep with the ‘-o’ flag.

You can also specify alternation using a pipe (|), like here:

speciali(s|z)e

This will find both:

  • specialise
  • specialize

When using the grep command, we need to escape the special characters (, |, and ) with backslashes as well as utilize the ‘-E’ flag to get this to work and avoid ugly errors.

escape paren pipe

As we mentioned above, this is because we need to tell the bash shell to pass these characters to grep and not to do anything with them. The ‘-E’ flag tells grep to use the parentheses and pipe as special characters.

You can search by exclusion using a caret that is both inside of your square brackets and at the beginning of a set:

tom[^F|0-9]

Again, if you’re using grep and bash, remember to escape that pipe!

caret

Terms that were in the list but did NOT show up are:

  • tom0
  • tom5
  • tom9
  • tomF

These did not match our regex.

How Can I Utilize Environments?

Often, we search based on boundaries. Sometimes we only want strings that appear at the beginning of a word, at the end of a word, or at the end of a line of code. This is can be easily done using what we call anchors.

Using a caret (outside of brackets) allows you to designate the “beginning” of a line.

^tom

beg of line

To search for the end of a line, use the dollar sign.

tom$

end of line

You can see that our search string comes BEFORE the anchor in this case.

You can also for matches that appear at the beginning or end of words, not whole lines.

<tom

tom>

beg of word

end of word

As we mentioned in the note at the beginning of this article, we need to escape these special characters because we’re using bash. Alternatively, you can also use single quotes:

beg of word q

end of word q

The results are the same. Make sure you use single quotes, and not double quotes.

Other Resources For Advanced Regexps

We’ve only hit the tip of the iceberg here. You can also search for money terms delineated by the currency marker, and search for any of three or more matching terms. Things can get really complicated. If you’re interested in learning more about regular expressions, then please take a look at the following sources.

  • Zytrax.com has a few pages with specific examples of why things do and do not match.
  • Regular-Expressions.info also has a killer guide to a lot of the more advanced stuff, as well as a handy reference page.
  • Gnu.org has a page dedicated to using regexps with grep.

You can also build and test out your regular expressions using a free Flash-based online tool called RegExr. It works as you type, is free, and can be used in most browsers.

7zip

7zip SFX Maker

Utilitaire permettant de créer des fichiers auto extractibles et surtout de préciser le chemin d’extraction.

  • Créer une archive avec 7zip
  • Lancer 7zip SFX Maker
  • Ajouter l’archive créée
  • Préciser les paramètres souhaités

Installation de logiciels sous windows

Assistant d’installation

  • Iexpress
    Intégré à windows XP voir le post suivant

Installation de logiciels en ligne

Installation de logiciels via une GUI

  • AppSnap
    Plus travaillé voir le post suivant

Installation de logiciels via un CD ou une clé USB

  • Install-It
    Simple mais efficace voir le post suivant
  • Multi-install
    Plus complexe voir le post suivant

Mise à jour de logiciels en ligne

Installation de logiciels via une GUI

Généralités

AppSpan est une application permettant de créer une installation automatique de logiciels via une GUI.

  • Application intéressante car possibilité d’avoir la main sur le fichier db.ini et de le configurer  pour télécharger les fichiers sur son propre serveur.
  • Possibilité d’avoir un dossier cache distant pour éviter les téléchargements en local.
  • Impossible de faire fonctionner un fichier db.ini de référence sur le serveur distant si la maj de l’application n’est pas opérationnelle.

Configuration

  • Le chemin d’accès au fichier latest.html,  localisé sur le serveur ftp (le-sau.emn.fr/ftp/latest.html), qui va être « scrapé » afin de définir la dernière version est spécifié dans le fichier config.ini local
  • La maj du fichier db.ini local fonctionne en cliquant sur l’icône Mise à jour. Le chemin d’accès au fichier de référence db.ini est spécifié dans le fichier config.ini local
  • Le fichie db.ini est sensible à la casse.
  • instversion = REGISTRY_SEARCH:DisplayVersion=FormatDeMaVersion
  • unintall=MaCléLogiciel (le joker * ne marche pas) ou alors
  • uninstall = REGISTRY_SEARCH:DisplayName=MaCléLogiciel*

NB : Fonctionnement « aléatoire » de la recherche des versions dans la base de registre, dommage 🙁

Liens

Blog : http://appsnap.wordpress.com/

Assistant d’installation sous windows

From CommentCaMarche :

Vous avez pu développer un petit logiciel et il vous manque un assistant simple et rapide d’installation de votre logiciel. La solution est simple et disponible sous Windows XP et Vista, sans avoir besoin d’un autre logiciel.
Cette astuce peut être aussi utilisée pour créer des archives auto-extractibles. Ces archives peuvent être utilisées sans aucun logiciel de compression, et sur n’importe quel PC.

  • Sous XP : tapez iexpress dans la commande Exécuter du menu démarrer et validez.
  • Sous Vista : tapez iexpress dans la barre Rechercher du menu démarrer et validez.

Cette fenêtre s’affiche :

  • La case Create new Self Extraction Directive file permet de créer une nouvelle archive auto-extractible.
  • La case Open existing Self Extraction Directive file permet d’ouvrir un ancien projet pour la création de ces archives.

Pour notre cas, on s’intéresse à la première case. Cliquez ensuite sur Suivant :

  • La première case créera l’assistant qu’on cherche.
  • La deuxième créera un archive auto-extractible simple.
  • La troisième créera un fichier compressé (cab), extractible manuellement.

Il n’y a pas une grande différence entre ces trois modes de création, juste quelques étapes sont omises.

On s’intéresse au cas le plus général : créer un assistant d’installation.
Cliquez sur Suivant :

Dans le champs du texte, entrez le texte qui va apparaître comme titre des fenêtres pendant l’installation du logiciel. Cliquez sur Suivant :

Si vous désirez que votre assistant d’installation envoie une petite confirmation avant l’installation, remplissez le texte à afficher, sinon laissez la case No Prompt cochée.
Cliquez sur Suivant :

Cette fenêtre est réservée aux logiciels protégés par des droits d’auteur et d’utilisation. Si vous souhaitez ajouter une licence à votre logiciel, c’est l’endroit où vous pouvez le faire. Il suffit juste de cocher la case Display a licence et ajoutez votre licence comme étant un fichier texte (txt). Le contenu de ce fichier sera affiché pendant l’installation. Cliquez sur Suivant :

Ici, c’est l’endroit où ajouter les fichiers à votre archive. Vous pouvez ajouter plusieurs fichiers simultanément.
L’essentiel dans tout ça, c’est d’avoir créé un fichier BATCH (bat) responsable de l’installation. Ce fichier est capable de copier, supprimer et renommer les fichiers ou bien copier, supprimer, renommer et créer des dossiers, suivant le besoin. Il contient des commandes en DOS (copy, xcopy, del, cd, …etc). Pour les non experts en DOS, voir ici ou bien ici.

Il faudra aussi ajouter ce fichier dans la liste des fichiers. Identiquement pour le fichier BATCH qui lancera le logiciel automatiquement à la fin de l’installation (si vous le désirez bien sûr).
Quand vous aurez terminé d’ajouter les fichiers, cliquez sur Suivant :

Dans la zone rouge, sélectionnez le fichier BATCH de l’installation. Et dans la zone bleue, sélectionnez celui responsable du lancement automatique du programme à la fin de l’installation. Puis cliquez sur Suivant :
Ici, ce sont les modes d’apparition de la fenêtre d’installation (Par défaut, invisible, réduit ou bien maximisé). Faites votre choix et cliquez sur Suivant :
Vous pouvez ajouter un message à la fin de l’installation, sinon cochez No message.
Cliquez sur Suivant :
Choisissez l’endroit où vous allez sauvegarder votre petit fichier exécutable final. Et ne touchez pas aux autres options, elles ne sont pas très utiles. Cliquez sur Suivant :
Si besoin d’un redémarrage du PC, c’est ici qu’on va configurer ça :

  • No restart : redémarrage non nécessaire.
  • Always restart : forcez le redémarrage.
  • Only restart if needed : redémarrez si c’est nécessaire.
  • La case Do not prompt user before restarting forcera le redémarrage sans demander à l’utilisateur.

Suivant :
Vous pouvez sauvegarder votre projet et si vous voulez y faire des modifications plus tard, il suffit de cocher la case Open existing Self Extraction Directive file, tout à fait au début, puis de donner le fichier (sed) sauvegardé.
Cochez Don’t save si vous ne voulez pas sauvegarder votre projet. Cliquez sur Suivant :
Un dernier Suivant.
La compression de votre archive va commencer, attendez jusqu’à la fin (suivant la taille totale de vos fichiers), puis cliquez sur Terminer.

Votre archive auto-extractible est créée, vous allez la retrouver à l’endroit que vous avez précisé à l’étape Package Name and Options. Il suffit de faire un double-clic dessus et l’installation va commencer.

Remarque importante :
Cette astuce n’ajoute pas votre programme dans la liste des programmes installés sur votre PC, donc la désinstallation de ce logiciel doit se faire manuellement.

Backup Google

From HowToGeek :

 

How To Download/Backup Your Gmail, Google+, Calendar, and Docs Data

Google has a tremendous number of free services they offer which many of your probably take advantage of. But have you ever considered what you might lose if all of a sudden you lost access to your account? Just like all import data on your hard drive, your critical data in “the cloud” should also have backup consideration.

So if your Google account contains data you can’t afford to lose or you simply would like to have a local copy of it for yourself, you can easily download just about everything.

Backup All Your Gmail Messages

Gmail offers the ability to download all your messages into a POP client. As you may know, a POP client downloads and stores local copies of emails to your hard disk so you can access them off-line or if you delete a message (which you have previously downloaded) from your Gmail account.

Once logged into Gmail, in the upper right corner click the gear icon and go to Mail Settings.

image

Under the Forwarding and POP/IMAP tab, select the option to Enable POP for all mail. Selecting this option will flag every email in your account to be downloaded to your POP client. Also be sure to select the option to keep Gmail’s copy in the inbox in step 2 so that when your messages are downloaded, they are not removed from your Gmail inbox.

Once you have set these options, save your changes.

image

Once POP access has been enabled on your account, you simply need to download the messages into your POP client. Google provides detailed instructions for several common email clients via the link in step 3. Rather than re-inventing the wheel in this article, check out their walkthroughs.

Backup All Your Gmail Contacts

After using Gmail for a while you will, no doubt, have many email contacts that you will want to backup as well.

On the left side menu, click the Contacts link. You can optionally select the contacts you want to export (if you are only exporting certain ones) or leave individual contacts unchecked and export groups.

Under the More actions menu, select the Export option.

image

Select the contacts you want to export (typically All contacts) and then the format. If you are unsure, select a CSV format because this will be readable in Excel or Notepad and just about every email client supports importing via a CSV file.

Once you have your options set, click Export.

image

Save the resulting file.

image

Download Your Google Plus Data

If you have a Google Plus account, you can easily download just about everything you have made available on the service.

Once logged into your Google Plus account, click on the gear icon in the upper left corning and select Google+ settings.

image

Select the Data liberation option on the right side menu and click Download your data.

image

The data included in the download is as follows:

  • +1′s = Web pages you have +1′d (which show in the +1 tab of your Google profile) in HTML format. This does not include every post or comment you have +1′d in the Google+ system.
  • Buzz = Google Buzz posts and replies in HTML format.
  • Contacts and Circles = Contact information by circle/group in VCF format.
  • Picasa Web Albums = Pictures uploaded to Picasa. These are organized in folders with the respective album name.
  • Profile = JSON file which contains the information in your Google profile. Don’t worry if you don’t know what this type of file is, you can open it and Notepad and read all the information.
  • Stream = Posts you have made in Google+ in HTML format. This does not include comments to posts you have replied to, only “top level” posts you have made.

You can download everything (as we do in this guide) or individual pieces. To download everything, click the Create Archive button.

image

Depending on the amount of data you have, this can take a while but once finished you will be presented with a Download button.

image

Once your download is ready, save it to your hard disk.

image

When you open the resulting zip file, you can see the data is organized into folders making it easy to navigate.

image

Download Your Google Calendars

If you utilize Google Calendars, you can easily export this information into ICAL format.

Once in your Google Calendar, click the gear icon in the upper left corner and select Calendar settings.

image

Under the Calendars tab, click the Export calendars link.

image

Save the resulting file to your hard drive.

image

When you open the downloaded zip file, you will have an ICAL file for each Google Calendar.

image

Download Your Google Reader Subscriptions

To download your Google reader subscriptions (note this downloads the source RSS feed links, not the content), click the gear icon in the upper left corner and select Reader settings.

image

Under the Import/Export tab, select the option to Export your subscriptions as an OPML file. This is simply a type of XML formatted file that you can open in Notepad to view the contents of.

image

Save the file to your hard drive.

image

Downloading Your Google Docs

If you make use of Google Docs, you can easily download selected or all documents at once. If you want only certain documents, pick the ones you want.

Once ready, under the Actions menu, select Download.

image

You will have some options with the format you want to download certain documents types in. For the most part the default settings will do but you can customize to fit your needs. Click the Download button once you are ready.

image

Save the resulting zip file to your hard drive.

image

When you open the zip file, the documents are in the format and folder structure used in Google Docs.

image

« Page précédentePage suivante »