Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#
# update_course_repo.sh
# Copyright (C) 2021 Uwe Schmitt <uwe.schmitt@id.ethz.ch>
#
# Distributed under terms of the MIT license.
#
set -e
NOTEBOOKS=??_*.ipynb
NEEDED="images data"
EXTRA="Install.md LICENSE intro_presentation environment.yml"
REPOURL=https://gitlab.ethz.ch/sis/machine-learning-workshop
echo
echo This script will upload the following files and folders to ${REPOURL}:
echo
for P in ${NEEDED} ${EXTRA} ${NOTEBOOKS}; do
echo " " ${P}
done
echo
echo you might be prompted to enter your NETHZ account name and password
echo
while true; do
read -p "Do you wish to continue?" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
FLDR=$(mktemp -d)
git -C ${FLDR} clone ${REPOURL}.git
ROOT=${FLDR}/machine-learning-workshop
test -d ${ROOT}/solutions || mkdir -p ${ROOT}/solutions
NOTEBOOKS=??_*.ipynb
NEEDED="images data"
EXTRA="Install.md LICENSE intro_presentation environment.yml"
cp -R ${NEEDED} ${NOTEBOOKS} ${ROOT}/solutions
cp -R ${NEEDED} ${EXTRA} ${ROOT}
for N in ${NOTEBOOKS}; do
jupyter nbconvert ${N} \
--TagRemovePreprocessor.enabled=True \
--TagRemovePreprocessor.remove_cell_tags='{"solution"}' \
--to notebook \
--output ${ROOT}/${N}
done
git -C ${ROOT} add ${ROOT}
git -C ${ROOT} commit -m "update"
git -C ${ROOT} push