Travaux
Dans le cadre de l'ESIL

La plupart de mes projets sont répertoriés sur mon gestionnaire de projet Redmine. Il est accessible ici.
Dans le cadre du DEUST GIES
KoffeeWeb
Site web réalisé dans le cadre d'un projet de 2ème année de DEUST GIES. Le visiter.
Avec, en parallèle, un projet en javascript consistant à intervertir des boites (dysfonctionne sous IE) : ici.
Proxy Squid avec authentification AD
Proxy GNU/Linux Squid gérant l'authentification depuis Windows Active Directory mis en place lors de mon stage de 2ème année au sein de l'entreprise Elyo Pacifique Informatique.
Voir mon tutoriel au format .pdf et les sources LaTeX.
Quelques scripts
gitignore todo gtrans photo-restore-catalogs-links Nautilus-presentation condom.sh palm-retry Nautilus-infos test.rb condom.rb photo-import takenote Nautilus-photo univmed-planning.rb tar-user-conf photo-dategitignore
Télécharger le script gitignore.1#!/bin/bash 2 3set -e 4 5[ ! -e .git ] || [ ! -d .git ] && { 6 echo "fatal: Not a git repository" >&2 7 exit 65 8} 9 10[ ! -e .gitignore ] && { 11 echo "create .gitignore..." 12 touch .gitignore 13} 14 15[ $# -eq 0 ] && { 16 echo "which file do you want to ignore?" >&2 17 exit 65 18} 19 20for i in $@ 21do 22 [ ! -e $i ] && echo "error: can't find \`$i'." >&2 23 if [ -n "$(grep -E "^$i\$" .gitignore)" ] 24 then 25 echo "info: \`$i' already ignored." 26 else 27 echo "$i" >> .gitignore 28 fi 29done 30 31exit 0 32Télécharger le script gitignore.
todo
Télécharger le script todo.1#!/bin/bash 2 3## This script allows you to manage a list of tasks. Use it as a reminder. 4## Tips: add `todo' at the end of your ~/.bashrc to run it on every shell opening ;) 5 6## By Vivien DIDELOT aka v0n 7## Last modification: 4 sept 09 8 9set -e 10 11SCRIPT=$(basename $0) 12TODOLIST=$HOME/.todolist 13ERROR=65 14 15if [ ! -e $TODOLIST ] ; then 16 touch $TODOLIST 17 echo "$SCRIPT: \`$TODOLIST' touched." 18fi 19 20LINES=$(wc -l < $TODOLIST) 21 22while getopts "hlad:p:c" OPTION 23do 24 case $OPTION in 25 h) # help 26 echo "Usage:" 27 printf "%-32s- %s\n" "$SCRIPT [-l]" "list tasks" 28 printf "%-32s- %s\n" "$SCRIPT [-a] 'something to do'" "add task (quotes may be optional)" 29 printf "%-32s- %s\n" "$SCRIPT -dX" "delete task number \`X'" 30 printf "%-32s- %s\n" "$SCRIPT -pX" "print task number \`X'" 31 printf "%-32s- %s\n" "$SCRIPT -c" "clear todolist (remove file)" 32 exit 0 ;; 33 l) # list, done after 34 ;; 35 a) # add, done after 36 ;; 37 p) # print 38 if [ ! -z "$(echo $OPTARG | sed s/[0-9]*//)" ] ; then 39 echo "$SCRIPT: argument must be an integer." >&2 40 exit $ERROR 41 elif [ $OPTARG -lt 1 ] || [ $OPTARG -gt $LINES ] ; then 42 echo "$SCRIPT: argument must be between 1 and $LINES." >&2 43 exit $ERROR 44 fi 45 sed -n "${OPTARG}p" $TODOLIST 46 exit 0 ;; 47 d) # delete 48 if [ ! -z "$(echo $OPTARG | sed s/[0-9]*//)" ] ; then 49 echo "$SCRIPT: argument must be an integer." >&2 50 exit $ERROR 51 elif [ $OPTARG -lt 1 ] || [ $OPTARG -gt $LINES ] ; then 52 echo "$SCRIPT: argument must be between 1 and $LINES." >&2 53 exit $ERROR 54 fi 55 sed -n "${OPTARG}p" $TODOLIST 56 read -p "$SCRIPT: delete task $OPTARG [Y/n] ? " QUESTION 57 case $QUESTION in 58 Y|y|'') 59 sed -i "${OPTARG}d" $TODOLIST 60 echo "$SCRIPT: task $OPTARG deleted." ;; 61 n) 62 echo "$SCRIPT: cancel." ;; 63 *) 64 echo "$SCRIPT: unknow answer." >&2 65 exit $ERROR ;; 66 esac 67 exit 0 ;; 68 c) # clear 69 read -p "$SCRIPT: clear todolist [Y/n] ? " QUESTION 70 case $QUESTION in 71 Y|y|'') 72 rm $TODOLIST 73 echo "$SCRIPT: todolist cleared." ;; 74 n) 75 echo "$SCRIPT: cancel." ;; 76 *) 77 echo "$SCRIPT: unknow answer." >&2 78 exit $ERROR ;; 79 esac 80 exit 0 ;; 81 *) 82 echo "$SCRIPT: invalid argument." >&2 83 echo "help: $SCRIPT -h" 84 exit $ERROR ;; 85 esac 86done 87 88shift $((OPTIND - 1)) 89 90if [ $# -eq 0 ] 91then # list tasks 92 if [ $LINES -eq 0 ] 93 then 94 echo "$SCRIPT: nothing to do!" 95 else 96 cat -n $TODOLIST 97 echo "--" 98 echo "TODO: $LINES tasks in \`$TODOLIST'." 99 fi 100else # add task 101 echo "$@" >> $TODOLIST 102 echo "$SCRIPT: task number $((LINES + 1)) added to todolist." 103fi 104 105exit 0 106Télécharger le script todo.
Warning: file(scripts/gtrans) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
gtrans
Télécharger le script gtrans.Télécharger le script gtrans.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
Warning: file(scripts/photo-restore-catalogs-links) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
photo-restore-catalogs-links
Télécharger le script photo-restore-catalogs-links.Télécharger le script photo-restore-catalogs-links.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
Nautilus-presentation
Télécharger le script Nautilus-presentation.1#!/bin/bash 2ooimpress -show $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS 3exit 0Télécharger le script Nautilus-presentation.
Warning: file(scripts/condom.sh) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
condom.sh
Télécharger le script condom.sh.Télécharger le script condom.sh.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
palm-retry
Télécharger le script palm-retry.1#!/bin/bash 2 3set -e 4 5palm-install -r com.lymphox.palm.memogame 6palm-package MemoGame 7palm-install com.lymphox.palm.memogame_1.0.0_all.ipk 8palm-launch com.lymphox.palm.memogame 9 10exit 0Télécharger le script palm-retry.
Nautilus-infos
Télécharger le script Nautilus-infos.1#!/bin/bash 2 3zenity --info --text=" 4\$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS : 5chemins des fichiers sélectionnés séparés par des retours à la ligne (newline) (uniquement pour les fichiers locaux) 6 7$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS 8 9\$NAUTILUS_SCRIPT_SELECTED_URIS : 10URIs des fichiers sélectionnés séparés par des retours à la ligne (newline) 11 12$NAUTILUS_SCRIPT_SELECTED_URIS 13 14\$NAUTILUS_SCRIPT_CURRENT_URI : 15URI de l'emplacement actuel 16 17$NAUTILUS_SCRIPT_CURRENT_URI 18 19\$NAUTILUS_SCRIPT_WINDOW_GEOMETRY : 20position et taille de la fenêtre actuelle 21 22$NAUTILUS_SCRIPT_WINDOW_GEOMETRY 23" 24 25exit 0Télécharger le script Nautilus-infos.
Warning: file(scripts/test.rb) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
test.rb
Télécharger le script test.rb.Télécharger le script test.rb.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
Warning: file(scripts/condom.rb) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
condom.rb
Télécharger le script condom.rb.Télécharger le script condom.rb.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
photo-import
Télécharger le script photo-import.1#!/bin/bash 2 3# this script imports single pic or pics and other files (such as videos, etc) from the directory given in parameter to your library (defined below). 4# it may create a catalog containing other files and symbolic links to every pics imported (catalog is necessary for non pic files). 5# it may be used recursively (the script will be executed for every subdirectories with the same catalog (if any). 6# Vivien DIDELOT a.k.a v0n 7 8# PARAMETERS 9# [OPTIONS] SOURCE 10# 11# OPTIONS 12# -h, --help 13# prints help 14# -V, --version 15# prints version 16# -c 'LABEL', --catalog='LABEL' 17# creates a catalog named LABEL (useful for events) 18# necessary for non pic files 19# -r, --recursive 20# uses this script recursively 21 22##### CONFIGURATION ##### 23 24LIBRARY_PATH=$HOME/Photos 25CATALOGS_PATH=$LIBRARY_PATH/catalogues 26UNDATED_PATH=$LIBRARY_PATH/undated 27 28FILENAME_FORMAT="%Y%m%d_%H%M%S" # see jhead documentation 29 30##### CHANGE NOTHING BELOW THIS LINE ##### 31 32DO_CATALOG=false 33RECURSIVE=false 34JPG_EXT="*jpg$|*JPG$|*jpeg$|*JPEG$" 35 36SCRIPT=$(basename $0) 37ERROR=65 38VERSION=1.1 39 40#set -e 41 42# check dependences 43if [ -z "$(which jhead)" ] ; then 44 echo "missing \`jhead' package." >&2 45 exit $ERROR 46fi 47 48##### FUNCTIONS ##### 49 50# usage of the script 51function PrintUsage 52{ 53 echo "USAGE:" 54 echo "$SCRIPT [-h|--help] [-V|--version] [-c LABEL|--catalog=LABEL] [-r|--recursive] DIRECTORY|FILE" 55} 56 57##### CHECK PARAMETERS ##### 58 59while getopts "hVc:r-:" OPTION 60do 61 # check long options 62 [ $OPTION = "-" ] && case "${OPTARG%%=*}" in 63 help) OPTION="h" ;; 64 version) OPTION="V" ;; 65 catalog) OPTION="c" ; OPTARG="${OPTARG#*=}" ;; 66 recursive) OPTION="r" ;; 67 *) echo "option longue non permise -- ${OPTARG%%=*}" >&2 ; exit $ERROR ;; 68 esac 69 case $OPTION in 70 h) 71 PrintUsage 72 echo 73 echo "VALUES:" 74 printf "%-24s%s\n" "library:" "$LIBRARY_PATH" 75 printf "%-24s%s\n" "catalogs path:" "$CATALOGS_PATH" 76 printf "%-24s%s\n" "undated files path:" "$UNDATED_PATH" 77 echo 78 echo "edit top of $0 to change values." 79 exit 0 ;; 80 V) 81 echo "$SCRIPT: version $VERSION." 82 exit 0 ;; 83 c) 84 DO_CATALOG=true 85 LABEL="$OPTARG" 86 CATALOG=$(echo "$LABEL" \ 87 | sed 'y/ÁÀÂÄÃáàâäãÉÈÊËẼéèêëẽÍÌÎÏĨíìîïĩÓÒÔÖÕóòôöõÚÙÛÜŨúùûüũÝỲŶŸỸýỳŷÿỹŃǸÑńǹñ/AAAAAaaaaaEEEEEeeeeeIIIIIiiiiiOOOOOoooooUUUUUuuuuuYYYYYyyyyyNNNnnn/' \ 88 | tr "[A-Z' ]" "[a-z__]" \ 89 | tr -d '!?~"=()[]{}$^:;,<>' \ 90 | tr -s '_' \ 91 | sed 's/^_\|_$//g') ;; 92 r) 93 RECURSIVE=true ;; 94 *) 95 echo "$SCRIPT: unknow option." >&2 96 PrintUsage 97 exit $ERROR ;; 98 esac 99done 100 101shift $((OPTIND - 1)) 102 103if [ $# -ne 1 ] ; then 104 echo "$SCRIPT: bad syntax." >&2 105 PrintUsage 106 exit $ERROR 107else 108 SOURCE="$1" 109 if [ ! -e "$SOURCE" ] ; then 110 echo "$SCRIPT: source \`$SOURCE' unreachable." >&2 111 exit $ERROR 112 else 113 SOURCE="${1%/}" 114 [ "${SOURCE:0:1}" != "/" ] && SOURCE="$(pwd)/$SOURCE" 115 fi 116fi 117 118if [ -d "$SOURCE" ] ; then 119 if ! $RECURSIVE ; then 120 if ! $DO_CATALOG && [ ! -z "$(file -Lb "$SOURCE"/* | grep -Ev 'directory|JPEG image')" ] ; then 121 echo "$SCRIPT: catalog needed to store non pic files." >&2 122 exit $ERROR 123 fi 124 else 125 if ! $DO_CATALOG && [ ! -z "$(ls -1LR --file-type "$SOURCE" | grep -Ev "^($SOURCE.*:|.*/|)$|$JPG_EXT")" ] ; then 126 echo "$SCRIPT: catalog needed to store non pic files." >&2 127 exit $ERROR 128 fi 129 fi 130else 131 if ! $DO_CATALOG && [ ! -z "$(file -b "$SOURCE" | grep -Ev 'JPEG image')" ] ; then 132 echo "$SCRIPT: catalog needed to store non pic files." >&2 133 exit $ERROR 134 fi 135fi 136 137##### PROGRAM ##### 138 139[ -d $LIBRARY_PATH ] || mkdir -vp $LIBRARY_PATH 140 141TMPDIR=$(mktemp -dt $SCRIPT.XXXXXXXXXX) 142echo "$SCRIPT: copying \`$(basename "$SOURCE")' to temp dir \`$TMPDIR'..." 143if [ -d "$SOURCE" ] ; then 144 for thisFILE in "$SOURCE"/* ; do 145 if [ -d "$thisFILE" ] ; then 146 ln -s "$thisFILE" $TMPDIR 147 else 148 cp "$thisFILE" $TMPDIR 149 fi 150 done 151else 152 cp "$SOURCE" $TMPDIR 153fi 154 155cd $TMPDIR 156 157echo "$SCRIPT: renaming files..." 158rename 's/Á|À|Â|Ä|Ã|á|à|â|ä|ã/a/g' * 159rename 's/É|È|Ê|Ë|Ẽ|é|è|ê|ë|ẽ/e/g' * 160rename 's/Í|Ì|Î|Ï|Ĩ|í|ì|î|ï|ĩ/i/g' * 161rename 's/Ó|Ò|Ô|Ö|Õ|ó|ò|ô|ö|õ/o/g' * 162rename 's/Ú|Ù|Û|Ü|Ũ|ú|ù|û|ü|ũ/u/g' * 163rename 's/Ý|Ỳ|Ŷ|Ÿ|Ỹ|ý|ỳ|ŷ|ÿ|ỹ/y/g' * 164rename 's/Ń|Ǹ|Ñ|ń|ǹ|ñ/n/g' * 165rename 'y/A-Z/a-z/' * # lowercase 166rename "y/ \"\'\!\?\=\(\)\[\]\{\}\$\^:;,<>/_/" * # replace special char to _ 167rename 's/__*/_/g' * # remove redondente _ 168rename 's/^_*|_*$//g' * # remove begining and ending _ 169 170$DO_CATALOG && mkdir -vp $CATALOGS_PATH/$CATALOG 171IS_FOLDER=false 172NB_PIC=0 173NB_FOLDER=0 174NB_NON_PIC=0 175 176echo "$SCRIPT: treatment of each files..." 177for thisFILE in * ; do 178 if [ "$(file -b $thisFILE | grep 'JPEG image')" ] ; then 179 # treatment of pics 180 NB_PIC=$((NB_PIC + 1)) 181 DATE=$(jhead $thisFILE | grep "Date/Time" | awk '{print $3}') # gets exif timestamp 182 if [ -z "$DATE" ] ; then 183 echo "INFO: no exif timestamp for \`$thisFILE' --> moved to \`$UNDATED_PATH'." >&2 184 thisFILE_PATH=$UNDATED_PATH 185 else 186 thisFILE=$(jhead -q -se -nf$FILENAME_FORMAT $thisFILE | awk '{print $3}') # rename and keep new name 187 jhead -q -se -ft $thisFILE # sets the file's system time stamp to the exif timestamp 188 189 YYYY=$(echo $DATE | cut -d: -f1) 190 MM=$(echo $DATE | cut -d: -f2) 191 DD=$(echo $DATE | cut -d: -f3) 192 193 thisFILE_PATH="$YYYY/$MM/$DD" 194 # links pics according to the hierarchy 195 $DO_CATALOG && [ ! -e $CATALOGS_PATH/$CATALOG/$thisFILE ] && ln -s ../../$thisFILE_PATH/$thisFILE $CATALOGS_PATH/$CATALOG 196 thisFILE_PATH=$LIBRARY_PATH/$thisFILE_PATH 197 fi 198 elif [ "$(file -Lb $thisFILE)" = "directory" ] ; then 199 # treatment of subdirectories 200 IS_FOLDER=true 201 if $RECURSIVE ; then 202 NB_FOLDER=$((NB_FOLDER + 1)) 203 $0 --recursive $($DO_CATALOG && echo "--catalog=\"$CATALOG\"") $thisFILE 204 else 205 echo "INFO: \`$thisFILE' is a folder, not processed (use recursive mode if needed)." >&2 206 fi 207 else 208 # treatment of non pic files 209 NB_NON_PIC=$((NB_NON_PIC + 1)) 210 thisFILE_PATH=$CATALOGS_PATH/$CATALOG 211 fi 212 213 if ! $IS_FOLDER ; then 214 [ -d $thisFILE_PATH ] || mkdir -p $thisFILE_PATH 215 cp $thisFILE $thisFILE_PATH/ 216 else 217 IS_FOLDER=false 218 fi 219done 220 221echo "$SCRIPT: END >> \`$(basename "$SOURCE")' done ($NB_PIC pics, $NB_FOLDER folders and $NB_NON_PIC other processed)." 222 223exit 0Télécharger le script photo-import.
takenote
Télécharger le script takenote.1#!/bin/bash 2 3set -e 4 5ARG=$@ 6ARG=${ARG// /_} 7NOTESDIR=~/notes 8NOTE=$(date +%a%d%m.%k%M%S) 9[ ! -z $ARG ] && NOTE=${NOTE}_$ARG 10 11[ ! -d "$NOTESDIR" ] && mkdir $NOTESDIR 12cd $NOTESDIR 13touch $NOTE 14 15cat << EOD >> $NOTE 16Note $@ 17prise le $(date +"%A %d %B %Y, %T") 18----------------------------------------- 19 20----------------------------------------- 21EOD 22 23vim $NOTE +4 24 25echo "note saved in $NOTESDIR/$NOTE" 26 27exit 0Télécharger le script takenote.
Nautilus-photo
Télécharger le script Nautilus-photo.1#!/bin/bash 2 3#TODO: ameliorer l'interpretation du choix pour l'importation 4 5##### CONFIGURATION ##### 6 7IMPORT_SCRIPT=~/scripts/photo-import 8DATE_SCRIPT=~/scripts/photo-date 9 10# take a look to the library configuration 11# at the top of file pointed by $IMPORT_SCRIPT 12 13##### END OF CONFIGURATION ##### 14 15# treat single file or directory (also the first selected) 16ARG="$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed -n '1p')" 17ARG_NAME="$(basename "$ARG")" 18ZENITY_OUT="zenity --text-info --width=600 --height=400" 19RECURSIVE=false 20 21if [ -z "$ARG" ] ; then 22 zenity --error --title="$(basename $IMPORT_SCRIPT)" --text="Aucune cible." 23 exit $ERR 24fi 25 26# check dependences 27if [ -z "$(which $DATE_SCRIPT)" ] ; then 28 zenity --error --title="$(basename $DATE_SCRIPT)" --text="\`$DATE_SCRIPT' introuvable." 29 exit $ERR 30elif [ -z "$(which $IMPORT_SCRIPT)" ] ; then 31 zenity --error --title="$(basename $IMPORT_SCRIPT)" --text="\`$IMPORT_SCRIPT' introuvable." 32 exit $ERR 33fi 34 35##################### 36##### FUNCTIONS ##### 37##################### 38 39function ExitOnCancel 40{ 41 if [ $? -eq 1 ] ; then 42 zenity --warning --title="$(basename $DATE_SCRIPT)" --text="Abandon." --width="200" 43 exit 0 44 fi 45} 46 47function GetHours { 48 HOURS=$(zenity --scale --title="$ARG_NAME" --text="Entrer les heures :" --min-value=-100) 49 ExitOnCancel 50 if [ $HOURS -lt 0 ] ; then 51 [ $HOURS -gt -10 ] && HOURS=${HOURS/-/-0} 52 else 53 [ $HOURS -lt 10 ] && HOURS=0$HOURS 54 HOURS=+$HOURS 55 fi 56} 57 58function GetDate { 59 DATE=$(zenity --calendar --title="$ARG_NAME" --text="Choisir la date :" --date-format="%Y:%m:%d") 60 ExitOnCancel 61} 62 63function GetTime { 64 HOURS=$(zenity --scale --title="$ARG_NAME" --text="Entrer les heures :" --min-value="0" --max-value="23") 65 ExitOnCancel 66 [ $HOURS -lt 10 ] && HOURS=0$HOURS 67 MINUTES=$(zenity --scale --title="$ARG_NAME" --text="Entrer les minutes :" --min-value="0" --max-value="59") 68 ExitOnCancel 69 [ $MINUTES -lt 10 ] && MINUTES=0$MINUTES 70 SECONDES=$(zenity --scale --title="$ARG_NAME" --text="Entrer les secondes :" --min-value="0" --max-value="59") 71 ExitOnCancel 72 [ $SECONDES -lt 10 ] && SECONDES=0$SECONDES 73 74 TIME=$HOURS:$MINUTES:$SECONDES 75} 76 77function Confirmation { 78 zenity --question --title="Confirmation" --text="$1 79Etes-vous sur ?" 80 ExitOnCancel 81} 82 83function DoRecursion { 84 $RECURSIVE && echo "--recursive" 85} 86 87function Check { 88 $DATE_SCRIPT --check $(DoRecursion) "$ARG" 2>&1 | sed \ 89 -e '/^ *$/d' \ 90 -e '/\(^[^file:]\|WARNING\)/{G;G;}' \ 91 -e 's/file: //' \ 92 -e 's/\([ ]*date: \| time: \)/\n/g' \ 93 -e 's/ [ ]*/ : /' \ 94 | zenity --list --title="Check $ARG_NAME" --column="Fichier" --column="Date" --column="Heure" --text="Informations sur $ARG_NAME : 95Des champs date et heure vides indiquent une erreur." --height=600 --width=800 96 ExitOnCancel 97} 98 99function Import { 100 OPTIONS=$(zenity --list --checklist --title="Import de $ARG_NAME" --text="Importation de $ARG_NAME. 101Le mode recursif permet de traiter egalement les sous-dossiers. 102Le catalogue est un dossier contenant un lien vers toutes les photos (utile pour un évènement donné) 103et est obligatoire lorsqu'il y a des fichiers qui ne sont pas des photos." \ 104 --column="" --column="" --column="Option" --column="Description" --hide-column="2" --print-column="2" --separator=" " \ 105 FALSE 1 "Catalogue" "Creer un catalogue" \ 106 $RECURSIVE 2 "Recursif" "Appliquer le script a tous les sous-dossiers") 107 ExitOnCancel 108 109 CATALOG= 110 if [ ! -z "$(echo "$OPTIONS" | grep 1)" ] ; then 111 CATALOGS_PATH=$($IMPORT_SCRIPT --help | grep 'catalogs path' | awk '{print $3}') 112 CATALOGS_LIST= 113 [ -e $CATALOGS_PATH ] && CATALOGS_LIST=$(ls $CATALOGS_PATH) 114 CATALOG="$(zenity --entry --title="$(basename $IMPORT_SCRIPT)" --text="Entrer un nom pour le catalogue :" --entry-text="$ARG_NAME" $CATALOGS_LIST)" 115 ExitOnCancel 116 fi 117 if [ ! -z "$(echo "$OPTIONS" | grep 2)" ] ; then 118 RECURSIVE=true 119 else 120 RECURSIVE=false 121 fi 122 123 $IMPORT_SCRIPT $(DoRecursion) $([ ! -z "$CATALOG" ] && echo "--catalog=${CATALOG// /_}") "$ARG" 2>&1 | $ZENITY_OUT --title="Import de $ARG_NAME" 124} 125 126function Menu { 127 CHOICE=$(zenity --list --title="$ARG_NAME" --text="Quelle action appliquer sur $ARG_NAME ?" \ 128 --column="" --column="Action" --hide-column="1" --print-column="1" \ 129 1 "Ajuster l'heure" \ 130 2 "Definir date et heure" \ 131 3 "Modifier seulement la date" \ 132 4 "Importer dans la librairie" \ 133 5 "Quitter" \ 134 --width=400 --height=250) 135 ExitOnCancel 136 137 case $CHOICE in 138 1) 139 GetHours 140 Confirmation "Ajuster de $HOURS heures." 141 $DATE_SCRIPT $(DoRecursion) ta$HOURS "$ARG" 2>&1 | $ZENITY_OUT --title="$ARG_NAME" 142 Check 143 Menu 144 ;; 145 2) 146 GetDate 147 GetTime 148 Confirmation "Date: $DATE Time: $TIME" 149 $DATE_SCRIPT $(DoRecursion) ts$DATE-$TIME "$ARG" 2>&1 | $ZENITY_OUT --title="$ARG_NAME" 150 Check 151 Menu 152 ;; 153 3) 154 GetDate 155 Confirmation "Date: $DATE" 156 $DATE_SCRIPT $(DoRecursion) ds$DATE "$ARG" 2>&1 | $ZENITY_OUT --title="$ARG_NAME" 157 Check 158 Menu 159 ;; 160 4) 161 Import 162 ;; 163 5) 164 ;; 165 esac 166} 167 168################### 169##### PROGRAM ##### 170################### 171 172if [ -d "$ARG" ] ; then 173 if [ ! -z "$(file -Lb "$ARG"/* | grep 'directory')" ] ; then 174 CHOICE=$(zenity --list --title="Recursion" --text="Il y a des sous-dossiers dans $ARG_NAME, 175appliquer le mode recursif (les actions seront appliquees aux sous-dossiers) ?" \ 176 --column="" --column="" --hide-column="1" --print-column="1" \ 177 1 "Oui" \ 178 2 "Non") 179 ExitOnCancel 180 [ $CHOICE -eq 1 ] && RECURSIVE=true 181 fi 182fi 183 184Check 185Menu 186 187exit 0Télécharger le script Nautilus-photo.
Warning: file(scripts/univmed-planning.rb) [function.file]: failed to open stream: Permission denied in /filer/eleves/d805106/public_html/php/scripts.php on line 14
univmed-planning.rb
Télécharger le script univmed-planning.rb.Télécharger le script univmed-planning.rb.
Warning: Variable passed to each() is not an array or object in /filer/eleves/d805106/public_html/php/scripts.php on line 20
tar-user-conf
Télécharger le script tar-user-conf.1#!/bin/bash 2 3set -e 4 5TAR=~/${USER}@${HOSTNAME}.conf.tar 6 7# checked files from $HOME are: 8CONF_FILES=( 9 .bashrc 10 .bash_aliases 11 .inputrc 12 .vimrc 13 .config/terminator/config 14 .unison/*.prf 15) 16 17cd $HOME 18 19# remove existing tar 20[ -e $TAR ] && rm -iv $TAR 21 22# check files and add them to tar 23for FILE in ${CONF_FILES[*]} ; do 24 [ -e $FILE ] && tar -rvf $TAR $FILE 25done 26 27echo "--> added to $TAR" 28 29exit 0Télécharger le script tar-user-conf.
photo-date
Télécharger le script photo-date.1#!/bin/bash 2 3# this script changes date of pics from directory or single pic given in parameter using jhead argument 4# note: needs bash version >= 3.2 (for regex comparaison) 5# Vivien DIDELOT a.k.a v0n 6 7SCRIPT=$(basename $0) 8ERR=65 9 10CHECK=false 11RECURSIVE=false 12SEC_INC=30 13 14#set -e # may cause unwanted exit with jhead 15 16# check dependences 17if [ -z "$(which jhead)" ] ; then 18 echo "missing \`jhead' package." >&2 19 exit $ERR 20fi 21 22##### FUNCTIONS ##### 23 24function PrintUsage 25{ 26 echo "Usage:" 27 echo "$SCRIPT -h" 28 echo "$SCRIPT [-r|--recursive] -c|--check DIRECTORY|FILE" 29 echo "$SCRIPT [-r|--recursive]Télécharger le script photo-date.DIRECTORY|FILE" 30} 31 32function PrintHelp 33{ 34 PrintUsage 35 echo 36 echo "-c option will check date of every pics and exit." 37 echo 38 echo " should be a valid jhead date modification option (without hyphen) :" 39 printf "%-25s - %s\n" "ta<+|-> " "adjust time" 40 printf "%-25s - %s\n" "tsyyyy:mm:dd-hh:mm:ss" "set time" 41 printf "%-25s - %s\n" "dsyyyy:mm:dd" "set date" 42 echo "see also jhead documentation (man jhead)." 43 exit 0 44} 45 46function CheckFile 47{ 48 DATE=$(jhead "$1" | grep "Date/Time") 49 50 printf "file: %-32s" "$(basename "$1")" 51 if [ -z "$DATE" ] 52 then echo "WARNING: no exif date" 53 else echo "date: $(echo "$DATE" | awk '{print $3}') time: $(echo "$DATE" | awk '{print $4}')" 54 fi 55} 56 57function ProcessFile 58{ 59 DATE=$(jhead "$2" | grep "Date/Time") 60 [ -z "$DATE" ] && jhead -mkexif "$2" 61 jhead -$1 "$2" # uses jhead with option given in parameter 62 jhead -q -se -ft "$2" # sets creation date with exif timestamp 63} 64 65##### CHECK PARAMETERS ##### 66 67while getopts "hcr-:" OPTION 68do 69 # check long options 70 [ $OPTION = "-" ] && case "${OPTARG%%=*}" in 71 help) OPTION="h" ;; 72 check) OPTION="c" ;; 73 recursive) OPTION="r" ;; 74 *) echo "option longue non permise -- ${OPTARG%%=*}" >&2 ; exit $ERROR ;; 75 esac 76 case $OPTION in 77 h) 78 PrintHelp 79 exit 0 ;; 80 c) 81 CHECK=true ;; 82 r) 83 RECURSIVE=true ;; 84 *) 85 echo "$SCRIPT: unknow option." >&2 86 PrintUsage 87 exit $ERROR ;; 88 esac 89done 90 91shift $((OPTIND - 1)) 92 93if $CHECK ; then 94 if [ $# -ne 1 ] ; then 95 PrintUsage 96 exit $ERR 97 else 98 SOURCE="$1" 99 fi 100else 101 if [ $# -ne 2 ] ; then 102 PrintUsage 103 exit $ERR 104 else 105 OPTION="$1" 106 SOURCE="$2" 107 if [[ ! "$OPTION" =~ ^(ta[+-][0-9]{2}|ts[0-9]{4}(:[0-9]{2}){2}-([0-9]{2}:){2}[0-9]{1,3}|ds[0-9]{4}(:[0-9]{2}){2})$ ]] ; then 108 echo "$SCRIPT: not a valid jhead option." >&2 109 PrintUsage 110 exit $ERR 111 fi 112 fi 113fi 114 115SOURCE="${SOURCE%/}" 116[ ! -e "$SOURCE" ] && echo "$SCRIPT: \`$SOURCE' unreachable." >&2 && exit $ERR 117 118##### PROGRAM ##### 119 120if $CHECK ; then 121 if [ -d "$SOURCE" ] ; then 122 for thisFILE in "$SOURCE"/* ; do 123 if [ -d "$thisFILE" ] ; then 124 if $RECURSIVE ; then 125 $0 --check --recursive "$thisFILE" 126 else 127 printf "file: %-32s%s\n" "$(basename "$thisFILE")" "WARNING: is a directory, not processed (use recursive mode if needed)." >&2 128 fi 129 else 130 if [ "$(file -b "$thisFILE" | grep 'JPEG image')" ] 131 then CheckFile "$thisFILE" 132 else printf "file: %-32s%s\n" "$(basename "$thisFILE")" "WARNING: is not a pic, not processed." >&2 133 fi 134 fi 135 done 136 else 137 if [ "$(file -b "$SOURCE" | grep 'JPEG image')" ] 138 then CheckFile "$SOURCE" 139 else printf "file: %-32s%s\n" "$(basename "$SOURCE")" "WARNING: is not a pic, not processed." >&2 140 fi 141 fi 142else # process files 143 if [ -d "$SOURCE" ] ; then 144 chmod +w "$SOURCE"/* 145 for thisFILE in "$SOURCE"/* ; do 146 if [ -d "$thisFILE" ] ; then 147 if $RECURSIVE ; then 148 $0 --recursive $OPTION "$thisFILE" 149 else 150 printf "file: %-32s%s\n" "$(basename "$thisFILE")" "WARNING: is a directory, not processed (use recursive mode if needed)." >&2 151 fi 152 else 153 if [ "$(file -b "$thisFILE" | grep 'JPEG image')" ] ; then 154 # if ts then SEC++ 155 if [ $(echo $OPTION | grep ts) ] ; then 156 SEC=$(echo $OPTION | cut -d: -f5) 157 SEC=$((SEC + SEC_INC)) 158 OPTION=$(echo $OPTION | cut -d: -f5 --complement):$SEC 159 fi 160 ProcessFile $OPTION "$thisFILE" 161 else printf "file: %-32s%s\n" "$(basename "$thisFILE")" "WARNING: is not a pic, not processed." >&2 162 fi 163 fi 164 done 165 else 166 if [ "$(file -b "$SOURCE" | grep 'JPEG image')" ] 167 then ProcessFile $OPTION "$SOURCE" 168 else printf "file: %-32s%s\n" "$(basename "$SOURCE")" "WARNING: is not a pic, not processed." >&2 169 fi 170 fi 171fi 172 173exit 0