-
Notifications
You must be signed in to change notification settings - Fork 12
/
prepare_for_git
executable file
·53 lines (35 loc) · 1.04 KB
/
prepare_for_git
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
#! /bin/bash
echo ""
echo "==============================="
echo "Removing all output from notebooks - please save them first!"
echo "==============================="
echo ""
read -r -p "Are you sure? [y/N] " response
echo ""
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
# only load the env if necessary
if hash conda 2>/dev/null; then
#conda installed
# this is for the computerroom HG D12
# I think it has no side effects on other systems
export CONDA_ENVS_PATH=/opt/kunden/hauser/conda/envs
else
#conda not installed
# for IAC systems
module load conda
fi
source activate pyvis
backup=./../.backup_pyvis/$(date '+%Y%m%d_%H%M%S')
echo "Backup notebooks to $backup, prior nbconvert"
echo "==============================="
echo ""
mkdir -p $backup
rsync -a --exclude .backup ./ $backup
echo "nbconvert: clearing code output"
echo "==============================="
echo ""
jupyter nbconvert ./*/*.ipynb --to notebook --inplace --ClearOutputPreprocessor.enabled=True
else
echo "Aborted"
fi