TABLE OF CONTENTS



  • Introduction


  • Monitoring Blog link - Icinga


  • Audio and video tools : ffmpeg/mencoder config and files


  • Other tools : calculator, ascii-hexa-bin converter, bash scripts, user kill, respawning processes,...


  • Good websites or add-ons : the name says it all!









  • 0.1) INTRO


    You can check the Monitoring Blog focusing on Icinga, Nagios, plugins, enhancements, scripts, bugs and so on! (under slow construction)


    The Monitoring Blog.





    1) AUDIO/VIDEO TOOLS






  • To install FFmpeg, you need the "sources" (or a generic package but it is less funny and you don't add your custom codecs). HERE are the FFmpeg sources".
    Link doesn't work? Or you prefer svn? Check the original FFmpeg site.


  • To install Mencoder and Mplayer, you also need the sources. HERE are the Mencoder/Mplayer sources.
    The linux essential x86 codecs.
    The linux complete x86 codecs.
    If you want, you can also go to the Mplayer/Mencoder official site.


  • Please have in mind to: install the codecs first, compile ffmpeg with the right options (and path to the codecs) and then compile Mencoder/Mplayer with the right options and link to the codecs!!







  • 2) OTHER TOOLS




  • A bash function you can put in your ".bashrc" file in order to have system infos when you type it:
    function myinfo()   # get current host related info
    {
    MY_IP=$(/sbin/ifconfig eth0 |awk '/inet/ { print
    } ' | sed -e s/addr://)
    echo -e "\nYou are logged on ${RED}$HOSTNAME"
    echo -e "\nAdditionnal information:$NC " ; uname -a
    echo -e "\n${RED}Users logged on:$NC " ; w -h
    echo -e "\n${RED}Current date :$NC " ; date
    echo -e "\n${RED}Machine stats :$NC " ; uptime
    echo -e "\n${RED}Memory stats :$NC " ; free -m
    echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:-"Not connected"}
    echo
    }


  • You have the "fortunes" installed on your computer with the BOFH special section? Add this line to your ".bashrc" to get the next excuse to say everytime you launch a terminal.
    echo -e "\n\t=>Next BOFH excuse to say today:\n \t\t \033[0;31m`fortune bofh-excuses | tail -n 1` \033[0;30m\n"


  • In bash, you want to create a script and don't want it to be executed twice at the same time? Use this!
    # Function that checks if script is already started
    function check_lock_file
    {
    PRGRM=`basename $0`
    # Clean up temporary files when exiting
    # comment 1st and last line of block for debugging temp results
    trap '
    if [ "`cat /tmp/${PRGRM}.pid`" == "
    quot; ] then


    rm -f /tmp/${PRGRM}.pid


    fi


    ' 0


    # Verify if the script is already running, in that case we exit with an error


    if [ -f /tmp/${PRGRM}.pid ] then


    echo "ERROR : Script is already running, exiting ..."


    exit 99


    else


    echo $ > /tmp/${PRGRM}.pid


    fi


    }
    And to use it, just call the function like this:
    #checking lock file: is script already running?
    check_lock_file



  • Creating an infinite loop to respawn process when they are dead. Can be used to auto-respawn a killed process (when you change his config file and have to restart it). Can also be used with a crontab killing the process in order for the process to be "fresh". Launch this as a "nohup &" with redirected output to /dev/null (>/dev/null).
    #!/bin/bash
    while [ 1 -eq 1 ]
    do
    nohup /home/your-respawning-script.sh >/dev/null
    sleep 20
    done



  • So you are root? Huh?!? Maybe you need to kill all process and connections of a user because he has process going nuts? Do it with this tiny script!
    #!/bin/bash

    if [ "$#" -ne 1 ]
    then
    echo "Not enough arguments: give me the name of a user to kill!"
    exit 1
    fi
    theid=`id "
    " | awk '{print 
    }' | awk -F= '{print 
    }' | awk -F\( '{print



    }'`
    if [ "$theid" -le 500 ]
    then
    echo "Some people can't be killed: they are gods..."
    exit 2
    fi
    kill -9 `ps -Aef | grep "
    " | grep -v "kill" | grep -v root | grep -v "cron" | grep -v "grep" | awk '{print 
    }'`









  • 3) THE WEB IS GOOD


  • Firefox is great! But when you just installed it, it is like... naked! So put him some add-ons. Here are my favourite add-ons and their use:

    -->> downloadhelper let you easily download any youtube, dailymotion and so on... video you are watching.

    -->> adblock plus removes lots of ads!

    -->> adblock filterset.g"> updater is used to update automatically the filter list of adblock plus as more and more ads appear on the web.

    -->> autocopy for windows to act like linux: autocopy the selected text to clipboard.

    -->> download statusbar so you no longer will see the annoying pop-up of download status.

    -->> gmail notifier to check your gmail account.

    -->> webmail notifier to check your hotmail accounts.

    -->> tamper data to modify the POST request sent by your browser in order to debug (or hack) your site sending buggy data, sql statements or to gain access to normally hidden parts of a site.




  • Great site to make your profile picture: MYPICTR. You just have to upload your picture and then you can select a part of it, crop it, resize and you get the resulting file. Really easy!




  • Here is a list of good freewares:

       -- >> PUTTY (ssh client)

       -- >> WINSCP (scp windows client)

       -- >> XMING (server X for windows, to use with putty)

       -- >> CYGWIN (for those who like it)

       -- >> FIREFOX (because I hate IE)

       -- >> THUNDERBIRD (because outlook express sucks)

       -- >> PDFCREATOR (to create pdf with a virtual printer)

       -- >> 7ZIP (compression needs)

       -- >> NOTEPAD++ (great notepad improvement)

       -- >> FILEZILLA (for ftp needs)

       -- >> OPEN-OFFICE (great office suite)

       -- >> GIMP (better than photoshop I think!)

       -- >> IRFANVIEW (picture viewer, same as acdsee)








  • 4) Here becomes the fun!




  • Some sites I like (mostly french):

       -- >> bashfr, LE site des perles du web!

       -- >> (ENGLISH) bash.org alias ZE site with funny geeky talks

       -- >> Chuck Norris facts en français car il est trop fort