import work from year 2016-2017
This commit is contained in:
31
tools/Other/archivage.sh
Normal file
31
tools/Other/archivage.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The next line tells bash to exit if a command return a non-true value
|
||||
set -e
|
||||
|
||||
|
||||
ROOT=`pwd`
|
||||
LIEU_ARCHIVES="$ROOT/Archive/2012-2013"
|
||||
|
||||
fichier_tex=`find $LIEU_ARCHIVES -iname "*.tex"`
|
||||
|
||||
for f in $fichier_tex; do
|
||||
dir=`dirname $f`
|
||||
if [ `basename $dir` != "fig" ]
|
||||
# On élimine les .tex qui sont dans fig/ pour ne pas compiler les images qui sont compilé autrement
|
||||
then
|
||||
echo "--------------------------------------------------"
|
||||
echo "On s'attaque à $f";
|
||||
echo "--------------------------------------------------"
|
||||
echo "On entre dans $dir"
|
||||
cd $dir
|
||||
ls
|
||||
echo "--------------------------------------------------"
|
||||
echo "On remplace le le lieu du fichier style"
|
||||
sed -i -e "s/lycee\/tools/lycee\/Archive\/2012-2013\/tools/g" $f;
|
||||
pdflatex $f;
|
||||
cd $ROOT
|
||||
echo "Fin du boulot sur $f"
|
||||
echo "--------------------------------------------------"
|
||||
fi
|
||||
done
|
33
tools/Other/change_root.sh
Normal file
33
tools/Other/change_root.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# The next line tells bash to exit if a command return a non-true value
|
||||
set -e
|
||||
|
||||
|
||||
ROOT=`pwd`
|
||||
OLD_ROOT="/media/documents/Cours/Prof/Enseignements"
|
||||
|
||||
fichier_tex=`find . -iname "*.tex" -o -iname "*.sty" -o -iname "*.cls"`
|
||||
|
||||
for f in $fichier_tex; do
|
||||
dir=`dirname $f`
|
||||
if [ `basename $dir` != "fig" ]
|
||||
# On élimine les .tex qui sont dans fig/ pour ne pas compiler les images qui sont compilé autrement
|
||||
then
|
||||
echo "--------------------------------------------------"
|
||||
echo "On s'attaque à $f";
|
||||
#echo "--------------------------------------------------"
|
||||
#echo "On entre dans $dir"
|
||||
#cd $dir
|
||||
#ls
|
||||
#echo "--------------------------------------------------"
|
||||
echo "On remplace le le lieu du fichier style"
|
||||
echo "On remplace $OLD_ROOT par $ROOT"
|
||||
sed -i -e "s|${OLD_ROOT}|${ROOT}|g" $f;
|
||||
#pdflatex $f;
|
||||
cd $ROOT
|
||||
echo "Fin du boulot sur $f"
|
||||
echo "--------------------------------------------------"
|
||||
fi
|
||||
done
|
26
tools/Other/doublea5.sh
Normal file
26
tools/Other/doublea5.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
IFS=$'\n'
|
||||
pdfs=`find $1 -iname "*.pdf"`
|
||||
|
||||
for i in $pdfs; do
|
||||
# On va chercher le format du pdf
|
||||
info=`pdfinfo "$i"`
|
||||
#echo "$info"
|
||||
size=`echo "$info" | grep "Page size" | cut -d':' -f2`;
|
||||
# On enlève les espaces
|
||||
size=${size//[[:blank:]]/};
|
||||
#echo "Size" $size
|
||||
# On va chercher le format du pdf
|
||||
page=`echo "$info" | grep "Pages" | cut -d':' -f2`;
|
||||
# On enlève les espaces
|
||||
page=${page//[[:blank:]]/};
|
||||
#echo $size
|
||||
if [ $size = "419.528x595.276pts" ] && [ $page = "1" ]; then
|
||||
outfile=${i%.pdf}_a4.pdf
|
||||
if ! [ -f $outfile ]; then
|
||||
echo "On double $i vers $outfile"
|
||||
pdfnup --suffix a4 $i $i --outfile $outfile
|
||||
fi
|
||||
fi
|
||||
done
|
95
tools/Other/fill_notes.py
Normal file
95
tools/Other/fill_notes.py
Normal file
@@ -0,0 +1,95 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim:fenc=utf-8
|
||||
#
|
||||
# Copyright © 2015 lafrite <lafrite@Poivre>
|
||||
#
|
||||
|
||||
"""
|
||||
|
||||
Parcours tous les dossiers et ajoute un fichier notes_***.rst quand il n'existe pas
|
||||
|
||||
"""
|
||||
|
||||
#import optparse
|
||||
import argparse
|
||||
from path import path
|
||||
import jinja2
|
||||
import copy
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("directory", help="Directory")
|
||||
|
||||
option = parser.parse_args()
|
||||
|
||||
templateLoader = jinja2.FileSystemLoader( searchpath="." )
|
||||
templateEnv = jinja2.Environment( loader=templateLoader )
|
||||
tpl_file = "./tools/Other/tpl_notes.rst"
|
||||
tpl = templateEnv.get_template(tpl_file)
|
||||
|
||||
cwd = path("./").abspath()
|
||||
directory = path(option.directory)
|
||||
|
||||
info = {"date" : "2013-07-01",
|
||||
"modified" : "2013-07-01",
|
||||
"summary": "Pas de résumé, note créée automatiquement parce que je ne l'avais pas bien fait...",
|
||||
"authors" : "Benjamin Bertrand",
|
||||
"tags": set(),
|
||||
"category": set(),
|
||||
"title" : "",
|
||||
"telechargeable" : [],
|
||||
}
|
||||
|
||||
ext_telechargeable = [".ipynb", ".ps", ".tex", ".pdf", ".csv", ".jpg", ".xlsx", ".xls", ".odt", ".ods", ".png", ".py", ".cls", ".sty", ".ggb", ".odc"]
|
||||
non_exam_type = ["Cours", "Exo", "TD"]
|
||||
exam_type = ["DS", "DM"]
|
||||
|
||||
def underline(string, cara = "#"):
|
||||
return string + "\n" + cara * len(string)
|
||||
|
||||
for i in directory.walkdirs():
|
||||
#if i.files("notes_*.rst"):
|
||||
if not i.files("index.rst"):
|
||||
cara = i.split('/')
|
||||
try:
|
||||
cara.remove('Archive')
|
||||
except ValueError:
|
||||
pass
|
||||
if cara[-1] not in ["fig", "Bilan", "Conn"]:
|
||||
folder_info = copy.deepcopy(info)
|
||||
folder_info["title"] = underline("Notes sur " + cara[-1].replace('_', ' '))
|
||||
|
||||
print(folder_info['title'])
|
||||
|
||||
folder_info["category"].add(cara[1])
|
||||
|
||||
try:
|
||||
tag = cara[2].replace('_', ' ')
|
||||
folder_info["tags"].add(tag)
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
folder_info['tags'] = folder_info['tags'].union(set([i for i in exam_type if i in cara]))
|
||||
folder_info['tags'] = folder_info['tags'].union(set([i for i in non_exam_type if i.lower() in [c.lower() for c in cara]]))
|
||||
|
||||
for f in i.files():
|
||||
if f.ext in ext_telechargeable:
|
||||
print("\t ",f.basename())
|
||||
folder_info["telechargeable"] += [f.basename()]
|
||||
|
||||
if (i/'fig').exists():
|
||||
for f in (i/'fig').files():
|
||||
if f.ext in ext_telechargeable:
|
||||
print("\t ",f.basename())
|
||||
folder_info["telechargeable"] += ['fig/'+f.basename()]
|
||||
|
||||
if folder_info["telechargeable"]:
|
||||
cible = i / "index.rst"
|
||||
with open(cible,'w') as f:
|
||||
f.write(tpl.render(folder_info))
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||
# cursor: 16 del
|
10
tools/Other/import_convert_icons.sh
Normal file
10
tools/Other/import_convert_icons.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
src=$1
|
||||
dest=$2
|
||||
|
||||
img=`find $src -iname "*.svg"`
|
||||
|
||||
for i in $img; do
|
||||
echo $i to $dest`basename ${i%.svg}.png`;
|
||||
#convert -negate $i -transparent white -resize 75 $dest`basename ${i%.svg}.png`;
|
||||
convert $i -transparent white -resize 75 $dest`basename ${i%.svg}.png`;
|
||||
done
|
13
tools/Other/tpl_notes.rst
Normal file
13
tools/Other/tpl_notes.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
{{ title }}
|
||||
|
||||
:date: {{ date }}
|
||||
:modified: {{ modified }}
|
||||
:tags: {{ tags | join(",") }}
|
||||
:category: {{ category | join(",") }}
|
||||
:authors: {{ authors }}
|
||||
:summary: {{ summary }}
|
||||
|
||||
|
||||
{% for tel in telechargeable %}
|
||||
`Lien vers {{tel}} <{{tel}}>`_
|
||||
{% endfor %}
|
Reference in New Issue
Block a user