Julienl's Blog

un blog de plus ou pas

Aller au contenu | Aller au menu | Aller à la recherche

vendredi, décembre 11 2009

Statistiques Folding@Home sur Conky

Je viens de finir de faire un script pour avoir mes statistiques de Folding@Home dans mon conky.

voici le script {{{ bash cd /tmp #on va dans le répertoire /tmp

wget "http://fah-web.stanford.edu/teamstats/team51.html" && on télécharge la page des stats de la team

  1. récupération des informations qui nous interessent

rank=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f3` rank_team=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f5` name=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f7` points=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f9` wu=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f11` team=`cat team51.html | grep julienl | sed -e 's/<^<>*>/ /g' | cut -d' ' -f13`

echo "$rank $rank_team $name $points $wu $team" > /home/julienl/scripts/conkys/folding #on envoi les valeurs dans le fichier pour notre conky

rm /tmp/team51.html

}}}

Nous avons donc notre fichier folding qui contient nos informations, on ajoute ce qu'il faut dans notre .conkyrc

voici par exemple ma partie folding.

{{{ conky

${color lightgrey}Folding@Home :

Name ${alignr}${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f3}
Score ${alignr}${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f4}
Position mondiale ${alignr}${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f1}
Position équipe ${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f6} ${alignr}${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f2}
Nombres de WU ${alignr}${exec cat /home/julienl/scripts/conkys/folding | cut -d' ' -f5}

}}} et le rendu :

Comme toujours si vous avez des améliorations à apporter à mon script ou autre, les commentaires sont les bienvenus

mardi, décembre 8 2009

Exemple de configuration conky

Mon Conky commençant à prendre pas mal de place j'ai décidé d'optimiser certains détails. Par exemple, lorsque mon interface wlan0 est down la partie wireless n'est pas affichée, de même pour la partie d'audacious.

Voici la capture et le code de conf.

#conky configuration example julienl.fr/blog
# set to yes if you want Conky to be forked in the background
background no
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Bitstream Monospace :size=8
own_window_transparent yes
own_window_colour hotpink
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Text alpha when using Xft
#xftalpha 0.8
#on_bottom yes
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 1
# Create own window instead of using desktop (required in nautilus)
own_window yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
minimum_size 300 5
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 10
# border margins
border_margin 0
# border width
border_width 0
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
gap_x 13
gap_y 13
alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no     
text_buffer_size 2048
      
TEXT



${alignc}${color lightblue}${font URW Chancery L:size=25}Julien@Gentoo${font}

${alignc}${color lightblue}${font URW Chancery L:size=40}${time %T}${font}

${color lightgrey}Kernel: $kernel 
${color lightblue}${hr 2}
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg
${color lightblue}${hr 2}
${color lightgrey}Intel(R) Core(TM)2 Duo T9600 @ 2.80GHz
${color lightgrey}Core 1: ${color lightblue}${cpubar cpu1}
${color lightgrey}Core 2: ${color lightblue}${cpubar cpu2}
${color black}${cpugraph cpu2 30,150 2C4B68 5C9CD9} ${color black}${cpugraph cpu1 30,150 2C4B68 5C9CD9}
${color lightgrey}RAM: $mem/$memmax - $memperc% ${color lightblue}$membar
${color lightgrey}Swap: $swap/$swapmax - $swapperc% ${color lightblue}${swapbar}
${color lightgrey}Processus: ${color lightblue}$processes  ${alignr}${color lightgrey}Running: ${color lightblue}$running_processes
${color lightblue}${hr 2}
${color lightgrey}Disques Durs:

${color lightgrey}Linux: ${fs_used /}/${fs_size /} ${color lightblue}${fs_bar /}
${color lightgrey}${if_mounted /media/seven}Seven x64: ${fs_used /media/seven}/${fs_size /media/seven} ${color lightblue}${fs_bar /media/seven}${endif}
${color lightgrey}${if_mounted /media/DD_HDD}Externe: ${fs_used /media/DD_HDD}/${fs_size /media/DD_HDD} ${color lightblue}${fs_bar /media/DD_HDD}${endif}
${color lightblue}${hr 2}
${color lightgrey}Temperatures:

${color lightgrey}Processeur $alignr ${acpitemp}°C
${color lightgrey}Carte graphique $alignr${execi 10 nvidia-settings -q gpucoretemp |grep Attribute |awk '{print $4}' | awk -F '.' '{print $1}'}°C
${color lightblue}${hr 2}
${if_up eth0}${color lightgrey}Ethernet:

Down:${color lightblue} ${downspeed eth0} k/s${color lightgrey} ${offset 70}Up:${color lightblue} ${upspeed eth0} k/s
${color black}${downspeedgraph eth0 30,150 2C4B68 5C9CD9} ${color black}${upspeedgraph eth0 30,150 2C4B68 5C9CD9}$endif
${if_up wlan0}${color lightgrey}Wireless:

Down:${color lightblue} ${downspeed wlan0} k/s${color lightgrey} ${offset 70}Up:${color lightblue} ${upspeed wlan0} k/s
${color black}${downspeedgraph wlan0 30,150 2C4B68 5C9CD9} ${color black}${upspeedgraph wlan0 30,150 2C4B68 5C9CD9}$endif
${color lightblue}${hr 2}
${color lightgrey}Processus:

${color lightgrey}Name              PID     CPU%   MEM%

${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color lightgrey} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}

${color lightgrey}Memoire	    PID	    CPU%   MEM%

${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color lightgrey} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${color lightgrey} ${top_mem name 5} ${top_mem pid 5} ${top_mem cpu 5} ${top_mem mem 5}
${color lightblue}${hr 2}
${color lightgrey}Port(s):

${color lightgrey}Ouverts : ${color orange}${tcp_portmon 1 65535 count} ${color lightgrey}Entrants : ${color red}${tcp_portmon 1 32767 count}  ${color lightgrey}Sortants : ${color lightgreen}${tcp_portmon 32768 61000 count}
${color lightblue}${hr 2}${if_running audacious2}
${color lightgrey}Audacious:

${color lightgrey}AUD:${color #C0C8CD} ${exec audtool2 --current-song | cut -b-34}
${color #C0C8CD}${exec audtool2 current-song-bitrate-kbps} kbps * ${exec audtool2 current-song-length} ${audacious_bar}
${color lightgrey}${hr 2}$endif

lundi, décembre 7 2009

Audacious2 avec conky

Pour utiliser Audacious dans votre conky, il suffit d'utiliser audtool2. Attention si vous être sous Gentoo, n'oubliez pas audacious dans le USE pour conky. Sinon ça ne fonctionnera pas.

Voici le bout de mon .conkyrc.

${color lightblue}${hr 2}
${if_running audacious2}
${color lightgrey}Audacious:
${color lightgrey}running :${color #C0C8CD} ${exec audtool2 --current-song | cut -b-34}
${color #C0C8CD} ${exec audtool2 current-song-bitrate-kbps} kbps * ${exec audtool2 current-song-length} ${execbar expr 100 \* $(audtool2 current-song-output-length-seconds) $(audtool2 current-song-length-seconds)}
${color lightgrey}${hr 2}$endif

Résultat rapide : il ne reste plus qu'à lire man audtool2 pour améliorer tout ça.

jeudi, avril 30 2009

Script fortune bashfr

En cherchant sur le net j'ai trouvé ce petit script que j'utilise pour mon conky:

#!/bin/bash # récupéré de http://forum.ubuntu-fr.org/viewtopic.php?pid=1470237 ##ce script installe fortune et les fortunes extraites du site bashfr.org ##Pour afficher une fortune extraite de bashfr, tapez fortune bashfr

mkdir ~/fortunetemp cd ~/fortunetemp wget -o /dev/null -N --referer=http://www.bashfr.org/ http://www.bashfr.org/bashfr_fortunes

##suprimme les liens vers bashfr a la fin des quotes # sed -e 's/^--\ http.*//g' bashfr_fortunes > bashfrtemp

##convertit le fichier en utf8 iconv -f iso-8859-1 -t utf8 bashfr_fortunes --output bashfr

##creation du fichier fortune strfile -s -r bashfr bashfr.dat

##deplacement du fichier fortune et de sa source dans le repertoire adequat sudo mv -f bashfr.dat /usr/share/games/fortunes/ sudo mv -f bashfr /usr/share/games/fortunes/

rm bashfr_fortunes rm bashfrtemp cd .. rm -rf fortunetemp

pour conky j'ai juste a ajouter ${execi 60 fortune /usr/share/games/fortunes/bashfr} pour avoir une citation :)

mardi, avril 28 2009

Conky quasi-terminé - Exemple d'un .conkyrc

Voilà mon conky est quasi fini :

Voici le .conkyrc:

Lire la suite...