/
bashrc
61 lines (55 loc) · 1.52 KB
/
bashrc
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
# add the following 2 lines into your .bashrc or .zhsrc (or your choice of bash shell):
# export TABML_BOOK='/path/to/this/repo'
# alias 2tabmlbook='cd $TABML_BOOK; source tabml_book_env/bin/activate; source bashrc'
function tabml_book_build() {
cd $TABML_BOOK
jupyter-book build book/
cp -R ./book/data_to_web ./book/_build/html/
}
function tabml_book_deploy() {
cd $TABML_BOOK
export DEPLOY='_deploy'
rm -rf $DEPLOY
mkdir $DEPLOY
git clone --single-branch --branch gh-pages https://github.com/tiepvupsu/tabml_book $DEPLOY/
cd $DEPLOY
rm -Rf *
cp -r ../book/_build/html/ ./
git add -f --all .
DATE_WITH_TIME=`date "+%Y-%m-%d_%H:%M:%S"`
git commit -m ":rocket: Deploy at $DATE_WITH_TIME"
git push
cd ../
rm -rf $DEPLOY
# Save cache
export CACHE='_cache'
rm -rf $CACHE
mkdir $CACHE
git clone --single-branch --branch build https://github.com/tiepvupsu/tabml_book $CACHE/
cd $CACHE
rm -Rf *
cp -r ../book/_build/ ./
git add -f --all .
DATE_WITH_TIME=`date "+%Y-%m-%d_%H:%M:%S"`
git commit -m "Save _build at $DATE_WITH_TIME"
git push
cd -
rm -rf $CACHE
}
function convert_notebooks() {
# for every notebook in one folder:
# convert it to markdown using jupytext
# prefix it by nb_ to avoid multiple files with same filenames (even with diff exts)
for nb in $(ls *.ipynb)
do
jupytext $nb --to myst
done
for nb in $(ls *.ipynb)
do
mv $nb nb_$nb
done
ls
}
function reinstall_tabml() {
python -m pip install --ignore-installed --no-deps git+https://github.com/tiepvupsu/tabml.git
}