diff --git a/pdf/condaCreatePDF.sh b/pdf/condaCreatePDF.sh new file mode 100755 index 000000000..23781b5c8 --- /dev/null +++ b/pdf/condaCreatePDF.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#Before launch: +# - install miniconda +# - create environment: $ conda env create --file environment.yml + +#Activate conda env +if [ -d "${HOME}/miniconda3" ]; then + source ${HOME}/miniconda3/etc/profile.d/conda.sh +else + CONDA_BASE=$(conda info --base) + source ${CONDA_BASE}/etc/profile.d/conda.sh +fi +conda activate pythonCheatsheet + +#Convert MD to html +mdFile=../README.md +grip --title=" " --export ${mdFile} + +#Convert html to PDF +# For full help, $ wkhtmltopdf --readme +ouputFile=../Comprehensive-Python-Cheatsheet.pdf +wkhtmltopdf --footer-left '[section] / [subsection]' --footer-line --footer-right '[page]' toc "${mdFile//.md/}.html" "${ouputFile}" diff --git a/pdf/environment.yml b/pdf/environment.yml new file mode 100644 index 000000000..73f903f3c --- /dev/null +++ b/pdf/environment.yml @@ -0,0 +1,11 @@ +name: pythonCheatsheet +channels: + - defaults + - conda-forge + - bioconda +dependencies: + - python=3.6 + - wkhtmltopdf + - pip + - pip: + - grip \ No newline at end of file diff --git a/pdf/how_to_create_pdf.md b/pdf/how_to_create_pdf.md index 2413a4df0..84bca350d 100644 --- a/pdf/how_to_create_pdf.md +++ b/pdf/how_to_create_pdf.md @@ -50,6 +50,25 @@ Printing the PDF ---------------- * Open a PDF that was optimized for printing in Chrome and print on A4 on both sides with default margins, scale 98% and no headers and footers. +How To Create PDF (using conda) +=============================== +Note: it was tested on Ubuntu 16.04, this might be compatible with other OS +Setup +----- + +* [Install miniconda](https://docs.conda.io/en/latest/miniconda.html) (or anaconda but it's bigger) +* Create environment: +``` +$ cd /python-cheatsheet/pdf +$ conda env create --file environment.yml +``` +Create PDF +---------- +* Run shell script: +``` +$ ./condaCreatePDF.sh +``` +* Voila!