mardi 15 décembre 2009

Bash tricks ":", la commande qui ne fait rien

En bash, la commande ":" ("column", ou "deux points") est une commande qui prend autant d'arguments que l'on veut mais qui ne fait rien.

C'est en particulier pratique pour commenter dynamiquement du code.
Par exemple :


#!/bin/bash
#DEBUG=echo
DEBUG=:

if [ -f /tmp/toto ]; then
$DEBUG "/tmp/toto existe"
echo `date` >>/tmp/toto
else
$DEBUG "/tmp/toto n'existe pas"
echo "fichier cree a `date`" > /tmp/toto

fi


Exem

Autour du code source et des programmes Java

SONAR :




Sonar est une plate-forme libre (LGPL v3) permettant de gérer la qualité du code source Java (exécution de tests unitaires, analyse de la couverture du code par ces tests, vérification du respect des règles de codage, complexité du code, etc.).
(depuis : dlfp )

http://sonar.codehaus.org/


FindBugs :




FindBugs is a program to find bugs in Java programs. It looks for instances of "bug patterns" code instances that are likely to be errors.


http://findbugs.sourceforge.net/
Éradiquer les lignes de code commentées

Forge des greffons Sonar


FindBugs serait en particulier beaucoup utilisé chez Google.

mercredi 4 novembre 2009

Multitâche ou pas ?


rabroué le multitâche

Qui l'eut cru ? Utiliser plusieurs applications simultanément ne nous rend pas plus productifs. Bien au contraire. Selon les scientifiques, le multitâche a plutôt un effet nocif sur notre cerveau car le changement de contexte permanent dégrade la mémoire et les capacités d'apprentissage. Sur le court terme, il nuit à la concentration et élève notre niveau de stress. Mais à plus long terme, il peut conduire à l'atrophie du cerveau. On n'était peut-être pas si mal lotis sous DOS…


01 Informatique n°1935, 07 Février 2008

jeudi 22 octobre 2009

Lire une iso de dvd video

Lire une iso de DVD vidéo.


mplayer dvd://1 -dvd-device FICHIER.ISO


Note : après, tout les racourcis de mplayer fonctionnent évidement.
Pour changer les sous-titres, par exemple, ce sera la touche "j".


Shortcuts mplayer

mercredi 21 octobre 2009

Bash "bind" command for defining keyshortcuts

http://www.geocities.com/h2428/petar/bash_bind.htm

On y trouve entre autre :


# Now map xterm's alternative keybindings to existing functionality
# Some are simple translations to correspontend M- combinations
# ctrl+left/right arrows:
bind '"\e\x5b\x31\x3b\x35\x44"':backward-word
bind '"\e\x5b\x31\x3b\x35\x43"':forward-word
# alt+b/f:
bind '"\xe2"':'"\M-b"'
bind '"\xe6"':'"\M-f"'
# atl+backspace:
bind '"\xff"':backward-kill-word
# alt+'.':
bind '"\xae"':yank-last-arg
# alt+k:
bind '"\xeb"':"\"\M-k\""
# alt+w:
bind '"\xf7"':'"\M-w"'

mercredi 14 octobre 2009

mount iso image via loopback under NetBSD

Mounting



# vnconfig vnd0 image.iso
# mount -t cd9660 /dev/vnd0a /mnt


Unmounting



# umount /mnt
# vnconfig -u vnd0



(Found here)

mercredi 30 septembre 2009

mardi 15 septembre 2009

Kernel Mode Setting (kms)

http://www.ubuntulinux.fr/index.php?post/2009/06/09/Tester-le-Kernel-Mode-Setting-(kms)-avec-une-carte-ATI


«Le kms est le fait que c'est le noyau qui apporte la gestion des accès à la carte graphique. Cela permet par exemple de faire tourner le serveur graphique sans lui donner de permissions de type root. Cela permettra également d'avoir des messages d'erreurs graphiques (l'écran marron de la mort ?). Et cela permettra d'éviter d'avoir des écrans qui scintillent/clignotent lors de changements de résolutions ou de basculements entre terminaux.»

dimanche 23 août 2009

live network trafic view ? iptraf, iftop

A explorer

http://www.commentcamarche.net/faq/sujet-848-linux-trafic-entrant-sortant-en-temps-reel


On trouvera ci dessous les extraits des deux manpages de iptraf et ethstatus.
Intéressant pour comptabiliser la quantité de données qui circulent sur les différentes interfaces, ainsi que pour monitorer quelles sont les connexions ouvertes.

Après un bref test, "ethstatus" m'a cependant l'air d'utiliser beaucoup de ressources CPU, et semble être surtout un reformatage des infos d'ifconfig. Peu intéressant donc.

Au contraire, "iptraf" était plus léger et apportait plus d'informations.

Egalement, iftop fourni plus d'informations et permet de lister les connextions courantes un peu comme "top" le ferait.






IPTRAF(8) IPTRAF(8)

NAME
iptraf - Interactive Colorful IP LAN Monitor

SYNOPSIS
iptraf { [ -f ] [ -q ] [ -u ] [ { -i iface | -g | -d iface | -s iface |
-z iface | -l iface } [ -t timeout ] [ -B [ -L logfile ] ] ] | [ -h ] }

DESCRIPTION
iptraf is an ncurses-based IP LAN monitor that generates various net‐
work statistics including TCP info, UDP counts, ICMP and OSPF informa‐
tion, Ethernet load info, node stats, IP checksum errors, and others.

If the command is issued without any command-line options, the program
comes up in interactive mode, with the various facilities accessed
through the main menu.



IFTOP(8) IFTOP(8)

NAME
iftop - display bandwidth usage on an interface by host

SYNOPSIS
iftop -h | [-nNpbBP] [-i interface] [-f filter code] [-F net/mask]

DESCRIPTION
iftop listens to network traffic on a named interface, or on the first
interface it can find which looks like an external interface if none is
specified, and displays a table of current bandwidth usage by pairs of
hosts. iftop must be run with sufficient permissions to monitor all
network traffic on the interface; see pcap(3) for more information, but
on most systems this means that it must be run as root.

By default, iftop will look up the hostnames associated with addresses
it finds in packets. This can cause substantial traffic of itself, and
may result in a confusing display. You may wish to suppress display of
DNS traffic by using filter code such as not port domain, or switch it
off entirely, by using the -n option or by pressing R when the program
is running.

By default, iftop counts all IP packets that pass through the filter,
and the direction of the packet is determined according to the direc‐
tion the packet is moving across the interface. Using the -F option it
is possible to get iftop to show packets entering and leaving a given
network. For example, iftop -F 10.0.0.0/255.0.0.0 will analyse packets
flowing in and out of the 10.* network.

lundi 20 juillet 2009

open microblogging tool (or : An open source twitter)

Laconi.ca is used on the website identi.ca as an open microblogging
tool. Microblogging is well known with the famous Twitter that allows
post of ~140 characters


The platform is freely (AGPL) available at :

http://laconi.ca/

There are plenty of plugins and application that can use it, and for
example it is working with :
* webinterface
* Jabber/GTalk
* email
* SMS


For those who only want to try it, they even made a concurrent of
twitter using the platform :

http://identi.ca/

tag: web, blog, php, opensource