Some of my scripts for daily use on a linux desktop

Sunday, February 28, 2010

Audio Spectrum Analyser / Equalizer

As you can see on this video, we can make some funny things with conky. (With recordmydesktop, I don't have a nice sound, and sound is not synchro to the video, sorry for that).
After drawing some bargraphs with Lua, I tried to draw an audio spectrum. This has nothing to do with Conky or Lua but all the work was already done for a screenlet named Impulse for gnome ().

This screenlet use a C library and some python bindings for drawing the spectrum. The main work to port this to conky was to translate drawing from python to lua and it was quiet easy.
I tried to make lua bindings for the C library but I didn't managed because I don't know C ! Even after reading this HowTo.

How the conky works ?
conkyrc load the Lua script and run the main function in Lua. This function create a pipe to the python binding linked to the C library at first run of the conky. After that, the Lua script read the values returned by python and draw the equalizer.
Also, I included the bargraph widget in the lua script so the spectrum can be more colorized ;-)

Bargraph widget

The version 2.0 of the bargraph is located here : I add more effects and it is more easy to configure with a table of settings :-)

While looking at an old hifi system with green and red equalizer, I tried to do the same with cairo. But with the powerful of cairo, we can do more than simple bar graph. So I wrote this script, really simple to use even if there are 20 parameters to set. But as you can see on the picture, the effects are well rendering!

22. Feb 2020:
I just updated the widget so it can receives not only conky stats but also numeric values.
For use with conky stat :
equalizer('cpu', 'cpu0', ...
for use with numeric values:
equalizer('', my_value, ...

I'have done that because I wanted to retain previous values from conky stats in order to display a progressing graph like on this video :

It's absolutely useless, isn't it !

The code for the video is on the crunbang forum.

28 Feb. 2010:
I renamed the widget from 'equalizer' to 'bargraph'

Last version can be downloaded from ubuntu forums : here

Happy conkying!

Tuesday, February 23, 2010

Links Index !

This page is the reference points for all the little scripts for Conky I posted around.
It will make life easier for people using theses scripts when they're looking for latest versions.

Recents updated scripts are on top!
First link is the link to the download page, second link is the link to the presentation page in this blog

Tuesday, February 2, 2010

How to get pictures from RSS feeds from deviantArt ( v1.0)

Each time you make a research on deviantArt web site (or when you browse a category) a RSS feed is generated.
For example, to see the newest deviations in the fractal category, the rss feed generated at the bottom of the page is

For my Photo Album script, I wanted to download/save pictures from the RSS feed to my hard drive.
Well, I wrote something and it works but it certainly can be improve!

I call this script : and it should be run with at least three arguments:
1st arg : folder where to save the pictures
2nd arg : delay (in minutes) for repeating the script (0 is for a single run)
3rd arg and following : urls of the rss feed to follow
and more parameters can be set inside the script

#example for photomanipulations, fractals categories and research for "conky"

./ /home/wlourf/deviant 5\&type=deviation\&type=deviation\&type=deviation\&type=deviation

IMPORTANT : In the RSS feed the symbol & has to replace by \& elsewhere it won't work

This script can also be downloaded here

En français (soyons fous) :
Ce script permet de télécharger les images des liens RSS générés sur les pages des résultats de recherche sur deviantArt.
Il fonctionne avec 3 arguments minimum :
1: le dossier où enregistrer les images
2: le temps à attendre entre chaque boucle (0 pour une seule boucle)
3 et suivants : liens RSS (Dans ces liens il faut remplacer & par /&)

The script :

#! /bin/bash
#This script get pictures from RSS feed from deviantArt website and save them to hard disk
# by wlourf
# v1.0 - 02 Feb. 2010
#1st arg : folder where to save the pictures
#2nd arg : delay (in minutes) for repetaing the script (0 is for a single run)
#3rd arg and following : urls of the rss feed to follow

#some paramaters are set here
#display filename even if it is not saved (ie saved previously)
#if script running in gnome_terminal, right click on the file can open it
############################# end ###########################


if [[ $# -lt 3 ]]; then
  echo 'This script needs at least 3 arguments : '
  echo ' - full path of the folder where save the pictures'
  echo ' - run the script every X minutes, 0 for a single run'
  echo ' - one or more RSS feeds to watch (take care to escape the & symbol with \&)'

rss=${args#$1" "}
rss=${rss#$2" "}

if [[ {$folder:-1} != "/" ]]; then

for url in $rss

while ( $flag ); do

  echo "-------------------"
  echo "folder = "$folder
  echo "-------------------"
  echo "loop every $repeat minutes"
  echo "-------------------"


  mkdir -p $folder
  cd $folder

  for ((u=1 ; u<=$nbUrl ; u++))
    #read one rss feed
    echo "-------------------"
    echo "rss $u/$nbUrl = "${tabRSS[u]}
    GET ${tabRSS[u]} > $file1
    #extract the link to the fullview image

    end="\" height"

    #put the links in a table for better display
    while read line
      if [[ "$line" =~ "${match}" ]]; then
        a=$(($(expr "$url_line" : ".*$begin")-${#begin}))
        b=$(($(expr "$url_line" : ".*$end")-$a-${#end}))
    done < $file1

    #read the table ans save the image if not already saved
    for ((a=1 ; a<=$nbLinks ; a++))
      img_name=$(expr match "$link" '.*\(/.*\)')
      txt="loop $nbLoops - url $u - $a/$nbLinks"
      if ($display_files_with_link) then
      if [ -f "$img_name" ]; then
        if ($display_files_not_saved) then
          echo $txt" - *** "$strFile" *** already saved"
        echo $txt" - "$strFile
        wget -q $link

    echo "$nbSaved/$nbLinks pictures saved for loop number $nbLoops and rss= $url"
    echo "-------------------"
  if [[ $repeat -eq "0" ]]; then

  nows=$(date +%s)
  echo "Wait $((sl/60)) minutes till :"
  date --date "$sl sec"

  sleep $sl

echo "Finish! after $nbLoops loop(s)"