import work from year 2015-2016

This commit is contained in:
Benjamin Bertrand
2017-06-16 09:48:54 +03:00
commit 25a2e9a4a7
1663 changed files with 455810 additions and 0 deletions

31
tools/Other/archivage.sh Normal file
View 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

View 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

95
tools/Other/fill_notes.py Normal file
View 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

13
tools/Other/tpl_notes.rst Normal file
View 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 %}